onShareAppMessage(res) {
if (res.from === 'button') {// 來自頁面內分享按鈕
console.log(res.target)
}
return {
title: '分享的標題',
path: '分享的路徑'
}
}
點擊button按鈕實現分享,同樣需要onShareAppMessage
<button open-type="share" :data-type='{title}' :data-id='{shareid}'></button>
注:如果需要帶參數,data-后面加你聲明的,例:data-id,在onShareAppMessage里面的res.target里面能找到傳遞的參數