webview.js 999 Bytes
let app = getApp();
Page({
  data: {
    isShow: false, // 控制组件显示隐藏
    url: '',
    message: "-",
  },
  onShareAppMessage(options) {
    return {
      title: 'title',
      path: this.url,
      success: function (res) {
        // that.web_url = return_url
        // 转发成功
        wx.showToast({
          title: "转发成功",
          icon: 'success',
          duration: 2000
        })

      },
      fail: function (res) {
        // 转发失败
      }
    }
  },
  onLoad(options = {}) {
    let url = options.url;
    url = "https://k.wxpai.cn/IdgW/index.html"
    console.log("url:", url);
    if (url) {
      this.setData({
        url: url,
        isShow: true
      })
    } else {
      // wx.showToast({
      //   title: '未找到页面地址',
      //   title: 'none',
      // });
    }
  },

  onBindMessage(e) {
    let postMessageData = e.detail.data[0]
    let openid = postMessageData.openid;
    app.store.setItem("openid", openid);
  }
})