• Mui-自定义事件跳转带参数


    ---event.html

    <!doctype html>
    <html>
    
        <head>
            <meta charset="UTF-8">
            <title></title>
            <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
            <link href="css/mui.min.css" rel="stylesheet" />
        </head>
    
        <body>
            <div class="mui-content">
              <ul class="mui-table-view" id="lists">
                  <li class="mui-table-view-cell" id="1">列表一</li>
                  <li class="mui-table-view-cell" id="2">列表一</li>
                  <li class="mui-table-view-cell" id="3">列表一</li>
              </ul>
            </div>
            <script src="js/mui.min.js"></script>
            <script type="text/javascript">
                mui.init();
                /*真机环境下运行调试*/
                mui.plusReady(function(){
                    /*进行预加载,用户没有点击是就已经加载完成*/
                        var prPage = mui.preload({url:'info.html',id:'info.html'});
                    mui('#lists').on('tap','li',function(){
                        mui.fire(prPage,'newsinfoEvent',{'title':this.innerHTML},{'id':this.getAttribute('id')});
                        mui.openWindow({url:'info.html',id:'info.html'});
                        
                    });
                });
            
            </script>
        </body>
    
    </html>

    ---info.html

    <!doctype html>
    <html>
    
    <head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="css/mui.min.css" rel="stylesheet" />
    </head>
    
    <body>
        <header class="mui-bar mui-bar-nav">
            <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
            <h1 class="mui-title" id="title1"></h1>
        </header>
        <div class="mui-content">
           
        </div>
    <script src="js/mui.min.js"></script>
    <script type="text/javascript">
        mui.init();
        mui.plusReady(function(){
            window.addEventListener('newsinfoEvent',function(e){
                var title1 = mui('#title1');
                title1[0].innerHTML = e.detail.title;
                mui.toast(e.detail.id);
            });
        });
    </script>
    </body>
    
    </html>
  • 相关阅读:
    Mybatis分页插件PageHelper简单使用
    UUID
    JavaWeb初学者session的使用
    轻松理解AOP思想(面向切面编程)
    DOM操作中,getElementByXXXX 和 querySelector 的区别
    DOM操作中,遍历动态集合的注意事项。ex: elem.children
    微信官方团队放出了UI库,看来以后前端还要学WeChatUI了,哈哈
    jQuery中使用$.each()遍历后台响应的json字符串问题
    平衡树
    后缀数组原理浅析(转载自tqx)
  • 原文地址:https://www.cnblogs.com/fdxjava/p/11074491.html
Copyright © 2020-2023  润新知