测试IOS-WEEX

2020-06-09 17:10:12 阅读:7 编辑
<template>
    <div>
        <web src="bmlocal://assets/w_system/test.html" style="width:750px;height:500px;"></web>
    </div>
</template>
<script>
    import wx from "./../../../common/wx"
    export  default {
        created() {
            var event = weex.requireModule('bmEvents')
            var that = this;
            event.on("bmPageFinish", function (params) {
                wx.alert("params");
                //console.log(params);
                // that.style = that.modifyStyle(params);

            }) // 监听事件
            event.on("event", function (params) {
                wx.alert("params");
                //console.log(params);
                // that.style = that.modifyStyle(params);

            }) // 监听事件
        },
        mounted() {
           /* var event = weex.requireModule('bmEvents')
            var that = this;
            event.on("bmPageFinish", function (params) {
                wx.alert("params");
                //console.log(params);
                // that.style = that.modifyStyle(params);

            }) // 监听事件*/
        }
    }
</script>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
    <title>测试</title>
</head>
<body>
<button onclick="closePage()"> 关闭当前页面 </button>
<button onclick="fireEvent()"> fireEvent </button>
</body>
<script>
    function closePage() {
        bmnative.closePage();
    }
    function fireEvent() {
        bmnative.fireEvent('event', {
            'name': 'xiaoming'
        });
    }
</script>
</html>