• chrome36可以使用自定义元素的回调了


    <!DOCTYPE html>
    <html>
        <head>
            <title>ms-attr-*</title>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width">
            <script src="avalon.js"></script>
    
            <script>
                avalon.define("test", function(vm) {
                    vm.toggle = true
                    vm.aaa = "aaa"
                    vm.click = function() {
                        vm.toggle = !vm.toggle
                        console.log(vm.toggle)
                    }
                    vm.change = function() {
                        vm.aaa = "bbb"
                    }
                })
                var XBooPrototype = Object.create(HTMLElement.prototype);
    
                XBooPrototype.detachedCallback = function() {
                    console.log("remove")
                }
                XBooPrototype.attachedCallback = function() {
                    console.log("add")
                }
                var XBoo = document.registerElement('x-boo-ir2', {
                    prototype: XBooPrototype
                });
           
                window.onload = function() {
                    var xboo = new XBoo()
                    var body = document.body
                    body.appendChild(xboo);
    
                    body.removeChild(xboo);
                }
    
            </script>
            <style>
                .aaa {
                    background: goldenrod;
                }
                .bbb{
                    background: green;
                }
            </style>
    
        </head>
        <body ms-controller="test">
    
            <div ms-hover="{{aaa}}:toggle" ms-click="click">ddddd</div>
            <button ms-click="change">点我</button>
        </body>
    </html>
    
    
  • 相关阅读:
    eXtremeDB 简单开发
    MFC PostMessage SendMessage
    char string 区别
    div 水平垂直居中
    npm—小记
    ECharts简单运行例子
    HTML在表格中添加echarts图表
    Sublime Text 3配置JavaScript运行环境
    bjdctf_2020_YDSneedGrirlfriend
    wdb_2018_2nd_easyfmt
  • 原文地址:https://www.cnblogs.com/rubylouvre/p/3952395.html
Copyright © 2020-2023  润新知