// 更新分享内容
updateShareData(order) {
if (!this.wxReady || !order) return;
// 构建分享内容
const shareLink = `https://test/test/${order.id}`;
const shareTitle = `测试分享卡片`;
const shareDesc = `测试`;
const shareImg = 'https://test.com/test.png';
// 更新分享给朋友的内容
wx.updateAppMessageShareData({
title: shareTitle,
desc: shareDesc,
link: shareLink,
imgUrl: shareImg,
success: () => {
console.log('分享给朋友内容更新成功');
},
fail: (err) => {
console.error('分享给朋友内容更新失败:', err);
}
});
},
重定向跳转接口
@GetMapping("/test/{orderId}")
public String orderDetailPage(@PathVariable String orderId) {
return "payment";
}
payment页面head
<meta property="og:title" content="测试">
<meta property="og:description" content="彩色">
<meta property="og:image" content="https://test.cn/hb.jpg">
<meta property="og:url" content="https://test.cn/">
<meta property="og:type" content="website">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- 引入WeUI样式库 -->
<link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.5.3/weui.min.css">
<link href="https://res.wx.qq.com/t/wx_fed/weui-source/res/2.6.11/weui.css" rel="stylesheet">
<link rel="stylesheet" href="https://weui.io/example.css" />
<style>

微信那边有检测机制,从不同的地方的进显示效果不一样的
同样是选中点击右上角3个点 分享给朋友 有些手机就能分享出来卡片形式 有些手机就分享出链接