• 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>
  • 相关阅读:
    [译]ABP vNext微服务演示,项目状态和路线图
    [译]初试C# 8.0
    [译]ABP vNext介绍
    ViewModel从未如此清爽
    python 函数基础及装饰器
    python 基础一
    scrapy基础二
    scrapy 基础
    python 基础技巧
    pandas 基础
  • 原文地址:https://www.cnblogs.com/yaowen/p/7121194.html
Copyright © 2020-2023  润新知