How to introduce vue into mixins
This article mainly explains "how to introduce vue into mixins". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how vue introduces mixins.
The specific steps are as follows:
1. First, create a new mixins file and define a mixins object in the file
Export const myMixin = {
Data () {
Return {
Num:1
}
}
Created () {
This.hello ()
}
Methods: {
Hello () {
Console.log ('hello from mixin')
}
}
}
After the 2.mixins object is defined, create a new vue project in vue-cli
Vue create project-name
3. Finally, after the vue project is created, use the import method in the project to import the mixins object into the vue project.
Impore {myMinxin} from'@ / assets/mixin.js'
Export default {
Mixin: [myMinxin]
}
At this point, I believe you have a deeper understanding of "vue how to introduce mixins". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!