chore:微信小程序分享正常
This commit is contained in:
@@ -199,7 +199,25 @@ export default {
|
||||
* 全局默认 onShareAppMessage:
|
||||
* uni-app 规范:组件自身的钩子优先级 > mixin,因此已显式声明的页面不受影响。
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
onShareAppMessage(options) {
|
||||
// 名片「发送名片」按钮(open-type="share")触发: dataset 携带名片信息 → 精准转发该名片
|
||||
// (覆盖默认 cfg 逻辑; 微信小程序无法在组件内直接定义转发, 只能由页面 onShareAppMessage 提供)
|
||||
if (
|
||||
options &&
|
||||
options.from === 'button' &&
|
||||
options.target &&
|
||||
options.target.dataset &&
|
||||
options.target.dataset.cardId
|
||||
) {
|
||||
const d = options.target.dataset;
|
||||
const name = d.cardName || '我的名片';
|
||||
const img = (this.$util && this.$util.img ? this.$util.img(d.cardQr) : d.cardQr) || '';
|
||||
return {
|
||||
title: name + ' 的电子名片',
|
||||
path: '/pages_tool/card/detail?card_id=' + d.cardId,
|
||||
imageUrl: img
|
||||
};
|
||||
}
|
||||
// 命中禁用列表的页面:即使 wx.hideShareMenu 因某些原因没生效,
|
||||
// 这里直接 return undefined / 也不主动拼 cfg,让微信回退到默认行为
|
||||
// (主防线是 wx.hideShareMenu,这里只是兜底)
|
||||
|
||||
Reference in New Issue
Block a user