<!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: {}
})

最新文章

  1. Vmware无法获取快照信息 锁定文件失败
  2. 正则表达式(转自https://segmentfault.com/a/1190000000699097)
  3. What Is Seedwork
  4. linux下log4j乱码解决
  5. sqlserver linkserver
  6. HEAD
  7. sysstat的基本用法
  8. React Native(ios)项目中logo,启动屏设置
  9. Toad for Oracle Authorization key
  10. HashMap大小选择
  11. javascript中的substr和substring
  12. 修改servu数据库密码 servu加密方式
  13. Why Are Thread.stop, Thread.suspend, Thread.resume and Runtime.runFinalizersOnExit Deprecated ?
  14. Virtual box中Ubuntu虚拟机磁盘碎片整理和空间清理方法
  15. 最好的8个 Java RESTful 框架
  16. Linux-C实现GPRS模块发送短信
  17. k8s 创建deployment流程
  18. 【jquery】jquery 自定义滚动条
  19. Java基础2-容器篇
  20. Maven学习总结(三):修改从Maven中心仓库下载到本地的jar包的默认存储位置

热门文章

  1. IDEA避免JAVA文件自动引入import.*包
  2. joyoi1935 「Poetize3」导弹防御塔
  3. x86保护模式 控制寄存器和系统地址寄存器
  4. Python之虚拟机操作:利用VIX二次开发,实现自己的pyvix(系列一)成果展示和python实例
  5. BZOJ 3205 [Apio2013]机器人 ——斯坦纳树
  6. 【DFS序+线段树区间更新区间求最值】HDU 5692 Snacks
  7. MATLAB(1)
  8. Codevs 2989 寻找somebody
  9. 【BZOJ2653】middle(主席树,二分)
  10. 【BZOJ2002】弹飞绵羊(LCT)