WebView组件打开公众号文章的分享问题?
发布于 5 年前 作者 ping22 6296 次浏览 来自 官方Issues

使用web-view组件打开公众号文章后,点击右上角分享后其它用户不能打开,提示业务域名错误,代码如下:

  /**
   * 页面的初始数据
   */
  data: {
    navUrl:""
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {   
    this.setData({
        navUrl:decodeURIComponent(options.url)
    });
  },  
/**
   * 用户点击右上角分享
   */
  onShareAppMessage: function (options) {
    var return_url = options.webViewUrl
    console.log(return_url);
    var path = 'pages/wx_artical/artical?url=' + return_url   //分享成功后跳转回本页面
    console.log(path, options)
    return {
      title: '分享',
      path: path
    }
  }

2 回复

你好,web-view可打开关联的公众号的文章,其它网页需登录小程序管理后台配置业务域名。具体可参考:https://developers.weixin.qq.com/miniprogram/dev/component/web-view.html

公众号文章,域名是微信的

回到顶部