Mrchenyong
Mrchenyong
  • 发布:2025-09-03 16:55
  • 更新:2025-09-03 17:23
  • 阅读:15

onShareAppMessage整个应用无法应用自定义的分享参数

分类:uni-app
技术栈:vue2升级到的vue3 @dcloudio/uni-app:3.0.0-alpha-3090720231104001 vue:3.3.4 分享到朋友圈的都可以。代码如下: // 不ok(以前应该是通的) onShareAppMessage(() => { const { marketOneCategId, marketCategId, fixedPrice: tempFixedPriceVal, price, productId, marketGoodsName, fileList = [], } = goods.value as any; const { servCategoryId } = variable; eventTracking.brandGlobalWechatShareClick({ ec_product_id: ${productId}, serv_categ_id: ${servCategoryId}, ec_categ_one_id: ${marketOneCategId}, ec_categ_two_id: ${marketCategId}, ec_product: marketGoodsName, is_fixed: tempFixedPriceVal === 2, //1否2是 original_total_amount: price, }); const pages = getCurrentPages(); const config = productId ? { title: 'marketGoodsName', path: /subPackages/goods/index?id=10906, // #ifdef MP-JD path: ${pages[pages.length - 1].route}?id=${productId}, // #endif // #ifndef MP-BAIDU imageUrl: 'https://img5.xiujiadian.com/test3/ocm-admin/file_ul17096282181709628218683.png', // #endif } {}; if (marketPageInfo.value.goodsPageStyle === 20) {
const { sharePicture, sharePictureDecs } = state.product2;
sharePicture && (config.imageUrl = sharePicture);
sharePictureDecs && (config.title = sharePictureDecs);
}
return config;
});

// 不ok现象,正常分给好友,但是路径和图片还有标题没有生效
// 其他信息
// 已经注释全局混入的分享,排除这个影响,

// ok
onShareTimeline(() => {
const { marketGoodsName, fileList = [], marketGoodsId = '' } = goods.value;
const config = {
title: marketGoodsName,
imageUrl: fileList.filter((itemm) => itemm.type === 30)[0]?.image,
query: id=${marketGoodsId},
};
if (marketPageInfo.value.goodsPageStyle === 20) {
const { sharePicture, sharePictureDecs } = state.product2;
sharePicture && (config.imageUrl = sharePicture);
sharePictureDecs && (config.title = sharePictureDecs);
}
return config;
});

2025-09-03 16:55 负责人:无 分享
已邀请:
蔡cai

蔡cai - 开发的插件:https://ask.dcloud.net.cn/article/41539

把代码用这个包起来,要不看起来好费劲

要回复问题请先登录注册