In this part, we will create the <script> section of the single file component. Follow these instructions to create the component correctly:
- Create a new file called userForm.vue in the src/components folder and open it.
- In the props Vue property, create two new properties called value and disabled, both being objects and having the three properties of type, required, and default. For the value property, the type will be Object, required will be false, and default will be a factory returning an object. For the disabled property, the type will be Boolean, required will be false, and the default will also be false:
props: {
value: {
type: Object,
required: false,
default: () => {
},
},
disabled: {
type: Boolean,
required: false,
default: false,
}
},
- In the data property, we need to add a new value of tmpForm, with the default value of an empty object:
data: () => ({
tmpForm: {},
}),
- In the Vue watch property...