提供的實例代碼:
Page({
onShareAppMessage: function (res) {
if (res.from === 'button') {
// 來自頁面內轉發按鈕
console.log(res.target)
}
return {
title: '自定義轉發標題',
path: '/page/user?id=123',//實驗發現,此處的路徑應該寫全,寫到具體的wxml頁面。如path:'/page/user/user?id=123'
success: function(res) {
// 轉發成功
},
fail: function(res) {
// 轉發失敗
}
}
}
})
當分享出去的卡片被點擊時,在頁面的onLoad(options){},options參數中接收
如上邊的實例代碼中 console.log( options.id ) //123