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

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <script src="traceur.js"></script>
        <script src="BrowserSystem.js"></script>
        <script src="bootstrap.js"></script>
        <script src="vue.js"></script>
    </head>
    
    <script type="text/traceur">
        // 定义一个混合对象
        var myMixin = {
          created: function () {
            this.hello()
          },
          methods: {
            hello: function () {
              console.log('hello from mixin!')
            }
          },
          render: function (createElement) {
            return createElement(
              'h' + this.level,   
              this.$slots.default
            )
          },
          //template:'<h3>我是标题33</h3>',
        }
        // 定义一个使用混合对象的组件
        var Component = Vue.extend({
          mixins: [myMixin],
          //template:'<h3>我是标题55</h3>'
        });
        //var component = new Component({
            //template:'<h3>我是标题55</h3>',
        //}) // -> "hello from mixin!"
        Vue.component('aaa',Component);
        /*new Vue({
          el: '#demo',
        });*/
    </script>
    
    <body>
    
        <div id="demo">
            <aaa>renderrender</aaa>
        </div>
        
    </body>
    </html>
  • 相关阅读:
    linux磁盘扩容脚本不重启
    编译安装redis
    编译安装nginx
    ansible常用模块
    centos7 yum安装ansible
    centos7 salt操作命令
    centos7 yum安装salt
    keep
    MySQL6
    MySQL5
  • 原文地址:https://www.cnblogs.com/yaowen/p/7121194.html
Copyright © 2011-2022 走看看