1、需求:用戶在邀請頁面獲取一定參數向好友分享,好友點擊后跳轉申請頁面
2、思路:利用小程序自帶button組件的open-type="share",觸發在js里面的onShareAppMessage方法去設置跳轉的頁面
3、實現:
wxml
<button open-type="share" class="btn_apply">邀請好友</button>
js
/** * 用戶點擊右上角分享 */ onShareAppMessage: function () { return { title: '訪客申請', path: `/pages/user/cusApply/cusApply?applyType=2` } }