uni-app开发APP和H5,分享功能

  • Post author:
  • Post category:其他




App

app分享以后一定是在H5页面进行查看的

若开发语言是uni-app的话可以在插件市场

APP分享、微博分享、QQ分享、微信好友、朋友圈 – DCloud 插件市场

              // #ifdef APP-PLUS   
                let shareData = {
                    shareUrl: "http://www.xxx.com/vue/xxx/index.html#/pages/shop/shopdetail/shopdetail?productId=" +
                        this.productId + "&type=" + this.type,
                    shareTitle: this.sDetail.productName,
                    shareContent: this.sDetail.productName + "从浏览器访问路径" + "http://www.xxx.com/vue/dly/xx.apk" +
                        "下载该app",
                    shareImg: this.sDetail.productImg,
                };
                appShare(shareData, res => {
                    console.log("分享成功回调", res);
                    closeShare();
                });
                // #endif
                //shareUrl 分享的路径
                //shareTitle 分享的标题
                //shareContent  分享的内容
                //shareImg  分享的图片


注意:如果是商品详情页面的话 访问链接的参数是需要自己拼接的

H5打包以后需要部署到服务器上才能使用 如果打包好后访问是空白页面

需要在manifest.json——h5配置——运行的基础路径——./

                // #ifndef APP-PLUS
                uni.showModal({
                    title: '请点击上方链接下载app操作!'
                })
                // #endif



版权声明:本文为jinxueer_111018原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。