Here, we will create the <script> section of the single file component:
- In the client/components folder, create a file named TodoList.vue and open it.
- Then, we will export a default JavaScript object, with a name property defined as TodoList, then define the beforeMount life cycle hook as an asynchronous function. Define the computed and methods properties as an empty JavaScript object. Then, create a data property defined as a singleton function returning a JavaScript object. In the data property, create a taskList property as an empty array:
export default {
name: 'TodoList',
data: () => ({
taskList: [],
}),
computed: {},
async beforeMount() {},
methods: {},
};
- In the computed property, create a new property called taskObject. This computed property will return the result of Object.fromEntries(new Map(this.taskList)):
taskObject() {
return Object.fromEntries(new Map(this.taskList));
},
- In the methods...