Let's code the <script> section of the single file component:
- Create a new file called userList.vue in the src/components folder.
- Import the changeRouterMixin from the src/mixin folder:
import changeRouteMixin from '@/mixin/changeRoute';
- Create an export default JavaScript object, and add a new Vue property called mixin, with a default value of an array. To this array, add the imported changeRouteMixin:
mixins: [changeRouteMixin],
- Create a new Vue property called computed. In this property, create a new value called userList. This property will be a function returning the Vuex store getter getUsersList:
computed: {
userList() {
return this.$store.getters.getUsersList;
},
},