async onShareAppMessage (res) {
const { userId} = this.$parent.globalData
const { orderId } = this
let shareBtnType = ""
if(res.from === 'button'){ // 避免点击右上角分享 报错
const {type} = res.target.dataset//如果是自定义组件内的分享按钮,也可以这样区分
shareBtnType = type
}
if(res.from === 'button' && (shareBtnType == 'redEnveBtn' || shareBtnType == 'redEnvelopesBtn')){
const {title,image:imageUrl,shareKey} = await getShareRedEnveConfig(orderId,userId)//解构赋值
const path = `pagesGroupBook/orderRedPacket/list?shareKey=${shareKey}&shareUserId=${userId}`
return {
title,
path,
imageUrl
}
}
}
总结:
主要考虑用await、async来处理
)
网友评论