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
Table of contents Basic Edition Step 1: Configure...
Table of contents Index Type Index structure Nonc...
Preface After the project is migrated to .net cor...
Large Text Data Types in Oracle Clob long text ty...
Tomcat server is a free and open source Web appli...
When developing a backend management project, it ...
Written in front I don’t know who first discovere...
Here are some common MySQL commands for you: -- S...
One-click execution To install Python 3.8 in a vi...
Table of contents 1. What is lazy loading of rout...
When we perform automatic discovery, there is alw...
Preface These principles are summarized from actu...
This article records the creation of a USB boot d...
xml <?xml version="1.0" encoding=&qu...
Table of contents mapState mapGetters mapMutation...