前往小程序,Get更优阅读体验!
立即前往
发布
社区首页 >专栏 >crmeb小程序商品信息分享到朋友圈教程

crmeb小程序商品信息分享到朋友圈教程

原创
作者头像
PHP开发工程师
修改2021-04-21 17:54:02
修改2021-04-21 17:54:02
70500
代码可运行
举报
文章被收录于专栏:thinkphp+vuethinkphp+vue
运行总次数:0
代码可运行

小程序商品信息界面分享到朋友圈加上以下代码,适合大部分用uniapp打包的,原生小程序一般也是没问题的

在\view\uni-app\pages\goods_details加上以下代码 在用户点击右上角分享的后面,

代码语言:javascript
代码运行次数:0
复制
/**
         * 用户点击右上角分享
         */
        // #ifdef MP
        onShareAppMessage: function() {
                let that = this;
                that.$set(that, 'actionSheetHidden', !that.actionSheetHidden);
                userShare();
                return {
                        title: that.storeInfo.store_name || '',
                        imageUrl: that.storeInfo.image || '',
                        path: '/pages/goods_details/index?id=' + that.id + '&spid=' + that.uid
                };
        },

就是上面这一句的后面,不懂看下面的图

代码语言:javascript
代码运行次数:0
复制
    //分享到朋友圈
    onShareTimeline: function() {
            let that = this;
            that.$set(that, 'actionSheetHidden', !that.actionSheetHidden);
            userShare();
            return {
                    title: that.storeInfo.store_name || '',
                    imageUrl: that.storeInfo.image || '',
                    path: '/pages/goods_details/index?id=' + that.id + '&spid=' + that.uid
            };
    },

如要显示销售价的话 用下面的代码 ps:¥你可以改为销售价啊,秒杀价啊,什么什么的,看你心情,你要咋改就咋改

代码语言:javascript
代码运行次数:0
复制
    //分享到朋友圈
    onShareTimeline: function() {
            let that = this;
            that.$set(that, 'actionSheetHidden', !that.actionSheetHidden);
            userShare();
            return {
                    title: '¥' + '【' + that.storeInfo.price + '】' + that.storeInfo.store_name || '',
                    imageUrl: that.storeInfo.image || '',
                    path: '/pages/goods_details/index?id=' + that.id + '&spid=' + that.uid
            };
    },

下面为显示销售价的

精品源码分享:http://github.crmeb.net/u/defu

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档