How vue uses mixin
This article mainly introduces vue how to use mixin, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Mixin
Function: register a mix that affects every Vue instance created after registration. Plug-in authors can use blending to inject custom behavior into components.
Usage:
/ / inject a processor for the custom option 'myOption'. Vue.mixin ({created: function () {var myOption = this.$options.myOption if (myOption) {console.log (myOption)}) new Vue ({myOption: 'hellograms'}) / / = > "hello!"
Description:
Object: an attribute or method of a vm
Ps: use global blending with caution, as it affects each separately created Vue instance (including third-party components). In most cases, it should only be applied to custom options, as in the example above. It is recommended to release it as a plug-in to avoid mixing with repeated applications.
Thank you for reading this article carefully. I hope the article "how to use mixin in vue" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!