本帖最后由 chenyuhan 于 2020-12-22 14:45 编辑
小程序商品信息界面分享到朋友圈加上以下代码,适合大部分用uniapp打包的,原生小程序一般也是没问题的
在\view\uni-app\pages\goods_details加上以下代码
在用户点击右上角分享的后面,
/**
* 用户点击右上角分享
*/
// #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
};
},
就是上面这一句的后面,不懂看下面的图
//分享到朋友圈
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:¥你可以改为销售价啊,秒杀价啊,什么什么的,看你心情,你要咋改就咋改
//分享到朋友圈
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
};
},
[/hide]
下面为显示销售价的
{{item.user_info.nickname ? item.user_info.nickname : item.user_name}}
作者 管理员 企业
{{itemf.name}}
{{itemc.user_info.nickname}}
{{itemc.user_name}}
回复 {{itemc.comment_user_info.nickname}}
{{itemf.name}}