In this part, we will create the <script> section of the single file component. Follow these instructions to create the component correctly:
- Create a file named view.vue in the src/components folder and open it.
- Import the UserForm component, the changeComponent mixin, and the getHttp from fetchApi:
import {
getHttp,
} from '../http/fetchApi';
import UserForm from './userForm';
import changeComponent from '../mixin/changeComponent';
- In the data property, we will add a userData object with the name, email, birthday, country, and phone properties all defined as empty strings:
data: () => ({
userData: {
name: '',
email: '',
birthday: '',
country: '',
phone: '',
},
}),
- In the Vue mixins property, we need to add the changeComponent mixin:
mixins: [changeComponent],
- In the Vue inject property, we need to declare the 'userId' property...