mui---通过mui.openWindow传递参数

openWindow_send_page.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>
        <button type="button" class="mui-btn mui-btn-green">用mui-openWindow向recieve_page页面传值</button>
        <script src="js/mui.min.js"></script>
        <script type="text/javascript">
            mui.init();
            //openWindow方式
            document.getElementsByTagName('button')[0].addEventListener('tap', function() {
                mui.openWindow({
                    url: 'openWindow_recieve_page.html',
                    id: 'openWindow_recieve_page',
                    extras: {
                        name: 'curry'
                    }
                });
            });
        </script>
    </body>

</html>

 

openWindow_recieve_page.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>
        <span id="span1">
            span1
        </span>
        <script src="js/mui.min.js"></script>
        <script type="text/javascript">
            mui.init();
            mui.plusReady(function() {
                var self = plus.webview.currentWebview();
                //或通过webview的id找到
                //var self=plus.webview.getWebviewById('openWindow_recieve_page');
                document.getElementById("span1").innerText = 'hi,' + self.name;
            })
        </script>
    </body>

</html>

 

posted @ 2018-05-30 22:01  框框A  阅读(1488)  评论(0编辑  收藏  举报