混合minxins
2024-09-06 10:44:50
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style> </style>
</head>
<body>
<div id="app">
<popup></popup>
<tooltip></tooltip>
</div> <script src="../lib/vue.js"></script>
<script src="js/main.js"></script>
</body>
</html>
#公共的东西写出来,下边直接调用,如果下边写了会被下边的覆盖掉
var base = {
methods: {
show: function () {
this.visible = true
},
hide: function () {
this.visible = false
},
toggle: function () {
this.visible = !this.visible
}
},
data: function () {
return {
visible: false
}
}
}; Vue.component("tooltip", {
template: `
<div>
<span @mouseenter="show" @mouseleave="hide">tool</span>
<div v-if="visible">张建平</div>
</div>
`,
minxins: [base],
data:function () { //覆盖minxins
return{
visible:true
}
}
});
Vue.component("popup", {
template: `
<div>
<button @click="toggle">Popup</button>
<div v-if="visible">
<span @click="hide">x</span>
<h4>title</h4>
this is my test page!
this is my test page!
this is my test page!
this is my test page!
this is my test page!
this is my test page!
this is my test page!
this is my test page!
</div>
</div>
`,
minxins: [base]
}); new Vue({
el: "#app",
data: {}
})
最新文章
- Vmware无法获取快照信息 锁定文件失败
- 正则表达式(转自https://segmentfault.com/a/1190000000699097)
- What Is Seedwork
- linux下log4j乱码解决
- sqlserver linkserver
- HEAD
- sysstat的基本用法
- React Native(ios)项目中logo,启动屏设置
- Toad for Oracle Authorization key
- HashMap大小选择
- javascript中的substr和substring
- 修改servu数据库密码 servu加密方式
- Why Are Thread.stop, Thread.suspend, Thread.resume and Runtime.runFinalizersOnExit Deprecated ?
- Virtual box中Ubuntu虚拟机磁盘碎片整理和空间清理方法
- 最好的8个 Java RESTful 框架
- Linux-C实现GPRS模块发送短信
- k8s 创建deployment流程
- 【jquery】jquery 自定义滚动条
- Java基础2-容器篇
- Maven学习总结(三):修改从Maven中心仓库下载到本地的jar包的默认存储位置