zoukankan      html  css  js  c++  java
  • Hbuilder主页面控制子页面的方法

    主页面的写法

    (function($, doc) {
                    mui.init({
                        swipeBack : false,
                        subpages: [{
                            id: 'addMemberContent',
                            url: 'addMemberContent.html',
                            styles: {
                                top: '45px',
                                bottom: 0,
                                bounce: 'vertical'
                            }
                        }]
                    });
                    $.plusReady(function() {
                        var postBtn=doc.getElementById('bntPost');//获取主页面按钮的DOM.
                        postBtn.addEventListener('tap',function(){    //监听DOM的事件
                            var addMemCont=plus.webview.getWebviewById("addMemberContent"); //根据ID获取子页面

            // var subPages=plus.webview.currentWebview().children();//获取当前页面所有的子页面;

            // var addmemCont=subPages[0]; 根据索引或缺子页面
                            $.fire(addMemCont,'postMember', null); // $.fire(目标页面,子页面的函数,要传的值)
                        });

        子页面的写法:

        window.addEventListener('postMember', function() { 

        //执行的函数}

        });

          window.addEventListener('newsId',function(event){ //获得事件参数 var id = event.detail.id;

  • 相关阅读:
    Linux下修改Mysql的用户(root)的密码
    Mysql 用户权限管理
    mysql的四种启动方式
    MySQL慢日志的相关参数
    mysqlsla slow-query常用用法

    导包和模块注意的问题
    Python面向对象之魔法方法/双下方法
    __new__问题
    转:Python常见字符编码及其之间的转换
  • 原文地址:https://www.cnblogs.com/isylar/p/4699863.html
Copyright © 2011-2022 走看看