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 1. Parameters that determine ca...
First of all, the blogger is playing the communit...
Download and install. First check whether there i...
Preface In the process of continuous code deliver...
XPath is a language for selecting parts of XML do...
A style sheet describes how a document should be ...
By default, processes in the container run with r...
This article example shares the specific code of ...
For Linux system administrators, it is crucial to...
Problem Description I want to use CSS to achieve ...
MySQL replace and replace into are both frequentl...
Table of contents JSX environment construction Se...
Table of contents 1. Why Redux 2. Redux Data flow...
RULES can be used to control the style of the int...
Download image docker pull openjdk Creating a Dat...