In this part, we will create the component mixin to be re-used in other components. Follow these instructions to create the component correctly:
- Create a new file called changeComponent.js in the src/mixin folder and open it.
- This mixin will have a method called changeComponent, which will emit a 'change-component' event with the name of the new component that needs to be rendered, and the userId:
export default {
methods: {
changeComponent(component, userId = 0) {
this.$emit('change-component', { component, userId });
},
}
}