Local Mixin<template> <div> <h2 @click="showName">Student name: {{name}}</h2> <h2>Student gender: {{sex}}</h2> </div> </template> <script> //Introduce a mixed import { hunhe,hunhe2 } from '../mixin' export default { name: 'Student', data() { return { name: 'Zhang San', sex: 'male' } }, mixins: [hunhe,hunhe2] } </script> export const hunhe = { methods: { showName() { alert(this.name) } } } export const hunhe2 = { data() { return { x: 100, y: 200 } } } Global Mixinsimport { hunhe, hunhe2 } from './mixin' Vue.mixin(hunhe) Vue.mixin(hunhe2) SummarizeThis article ends here. I hope it can be helpful to you. I also hope you can pay more attention to more content on 123WORDPRESS.COM! You may also be interested in:
|
<<: CSS3 uses scale() and rotate() to achieve zooming and rotation
>>: Blog Design Web Design Debut
Index definition: It is a separate database struc...
This article mainly introduces an example of how ...
Preface Two types of swap space can be created un...
This article example shares the specific code of ...
There are three main ways of MySQL replication: S...
Table of contents 1. Display and hide by default ...
Table of contents Purpose npm init and package.js...
It took me three hours to install MySQL myself. E...
KDE Abbreviation for Kool Desktop Environment. A ...
1. Alibaba Cloud selects the appropriate cloud se...
1. Download address: mysql-8.0.17-winx64 Download...
1. Problem description The storage installed in t...
Table of contents Preface Can typeof correctly de...
Preface This article mainly shares with you the g...
1. Enter the following address in the browser htt...