123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <template>
- <view class="container">
- <web-view src="https://uat.jzmall.lifejingzhi.com/address.html" @load="webviewOnLoad" @message="onMessage"></web-view>
- </view>
- </template>
- <script>
- var util = require('../../../utils/util.js');
- var api = require('../../../config/api.js');
- var app = getApp();
- export default {
- data() {
- return {};
- }
- /**
- * 生命周期函数--监听页面加载
- */,
- onLoad: function (options) {},
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {},
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {},
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {},
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {},
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {},
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {},
- methods: {
- onMessage(options) {
- /**
- * 网页的消息发出顺序为 postMessage1、postMessage2、postMessage3
- * options.detail.data 的详细内容分别为:
- * [{ mes: "postMessage1" }, { mes: "postMessage2" }, { mes: "postMessage3" }]
- */
- console.log(options);
- console.log('onmessage:');
- console.log(options.detail.data);
- let data = options.detail.data;
- let address = data.length > 1 ? data[1].mes : data[0].mes;
- let msg = JSON.parse(address);
- console.log(msg);
- app.globalData.webAddress = msg;
- },
- webviewOnLoad() {
- console.log('webview 加载成功');
- }
- }
- };
- </script>
- <style></style>
|