Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to introduce vue into mixins

Shulou Source: shulou.com Published: 2022-05-31 13:24:49 10月03日 Update

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!

Tags: Project object content file method learning practical deeper interest practical easy to operate more friends steps website channel Zhongxin query Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei MariaDB Shulou Tech Info Apple macOS