This commit is contained in:
2026-09-04 15:27:46 +08:00
parent ee16f17742
commit 98579baf8f
3 changed files with 49 additions and 0 deletions
+13
View File
@@ -97,6 +97,19 @@ export default {
onUnload() {
this.stopAutoPlay()
},
// 微信小程序:分享给朋友
onShareAppMessage() {
return {
title: '印美达 Inkreach',
path: '/pages/index/index'
}
},
// 微信小程序:分享到朋友圈(query 为查询字符串,打开时传给本页 onLoad)
onShareTimeline() {
return {
title: '印美达 Inkreach'
}
},
methods: {
// 全局加载苹方子集字体(常用3500字+数字英文,约700KB)
// 必须在页面加载后调用(App onLaunch 里页面未创建会报 not font page
+23
View File
@@ -160,6 +160,29 @@ export default {
if (options && options.id) {
this.productId = options.id
this.loadDetail(options.id)
} else {
// 钩子保护:无 id 时(如异常入口进入详情页)回产品列表页(tabBar 页需用 switchTab
uni.switchTab({ url: '/pages/products/products' })
}
},
// 微信小程序:分享给朋友(带上当前产品 id,好友点开直达该产品详情)
onShareAppMessage() {
return {
title: this.product.name || '产品详情',
path: this.productId
? `/pages/product-detail/product-detail?id=${this.productId}`
: '/pages/product-detail/product-detail',
imageUrl: (this.productImages && this.productImages[0]) || ''
}
},
// 微信小程序:分享到朋友圈
// query 是查询字符串(不带 ?),朋友圈单页模式打开时直接传给本页 onLoad(options)
// 现有 onLoad 已处理 options.id,无需额外跳转(单页模式下 navigateTo 不可用)
onShareTimeline() {
return {
title: this.product.name || '产品详情',
query: this.productId ? `id=${this.productId}` : '',
imageUrl: (this.productImages && this.productImages[0]) || ''
}
},
methods: {
+13
View File
@@ -159,6 +159,19 @@ export default {
// 这里兜底触发一次重算(防止某些端 mounted 比父组件 onLoad 晚)
this.recomputeScrollHeight()
},
// 微信小程序:分享给朋友
onShareAppMessage() {
return {
title: '印美达 Inkreach - 产品中心',
path: '/pages/products/products'
}
},
// 微信小程序:分享到朋友圈(query 为查询字符串,打开时传给本页 onLoad)
onShareTimeline() {
return {
title: '印美达 Inkreach - 产品中心'
}
},
methods: {
async initData() {
try {