Here, we are going to create the <script> section of the single file component:
- Open the Edit.vue file in the users folder inside the view folder.
- In the Vue data property, change the name of the data from userData to tmpUserData:
data: () => ({
tmpUserData: {
name: '',
email: '',
birthday: '',
country: '',
phone: '',
},
}),
- In the Vue computed property, add a new property called userData, which will return the Vuex getter getUserData:
userData() {
return this.$store.getters.getUserData;
}
- Add a new Vue property named watch, and add a new property, userData, which will be a JavaScript object. In this object, add three properties, handler, immediate, and deep. The handler property will be a function that receives an argument called newData, which will set tmpUserData to this argument. The immediate and deep properties are both boolean properties set to true:
watch...