在分享之前做一些操作 比如调用后端的接口
<button :open-type="share" hover-class="navigator-hover" class="atten-btn" ref="bnt" @click="mpShare()">分享给朋友</button>
点击按钮之后
mpShare(){
不想主动触发分享
if(){
在调用分享
}
}
扫描小程序码分享
在分享之前做一些操作 比如调用后端的接口
<button :open-type="share" hover-class="navigator-hover" class="atten-btn" ref="bnt" @click="mpShare()">分享给朋友</button>
点击按钮之后
mpShare(){
不想主动触发分享
if(){
在调用分享
}
}
楼主,解决了吗。
onShareAppMessage只能配置在当前页面,无法在子组件中渲染,button可以放在子组件中引进来,点击就会调用当前页面的分享配置。且button只能手动点击触发,无法通过js触发
你这种实现不了,只有换其他方式
可以参考文档,https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/miniapp/component/onShareAppMessage.html
设置了open-type="share"就不会触发mpShare方法,分享要写在onShareAppMessage方法里面