zoukankan      html  css  js  c++  java
  • 混合minxins

    <!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: {} })
  • 相关阅读:
    RESTful API 设计指南
    Lombok 安装配置及使用方法
    Python——urllib函数网络文件获取
    C与C++面试易出知识点
    编程一年
    Java练习1
    大整数求和
    PHP数组知识点整理
    CSS——NO.10(设置技巧)
    CSS——NO.9(颜色值和长度值)
  • 原文地址:https://www.cnblogs.com/52-qq/p/8387097.html
Copyright © 2011-2022 走看看