petervmeijgaard/vue-2-boilerplate

How to use the mixin ?

paolog22 opened this issue · 2 comments

hi sir.. i try to write a mixin inside a module and try to get it as import { mixin } from '@/store/modules/account';
this doest work but this one
import { mixin } from '@/store/modules/account/mixin';

am i doing it right ?
thanks

Why are you trying to import a mixin from the store? A mixin is used to extend a Vue component and can been used by multiple components. This means that you don't have to write the same code over and over again.

I've added the slot-mixin as an example. Just import it in the component by typing import sloMixin from '@/mixins/slot' and use it in your component by typing:

export default {
  slots: [slotMixin], 
};

Please make sure you read the documentation before creating a new issue. Everything about mixins is documented at the Vue docs.

copy sir thank you. sorry