requestSubscribeMessage 无法调用?

发布于 8 年前作者 rxie6659 次浏览最后编辑 8 年前来自 issues

在界面上放置一个按钮,用于获取授权推送消息

<button  bindtouchend=“authMsg”>授权金叶医生推送消息</button>

事件中是这么写得

authMsg(event) {
 
wx.requestSubscribeMessage({
 
tmplIds: ['bPJUjgxTYg9yN3fn2tg4PaStW1I--DiZ7rr7KU8LQLo'],
 
success: function (res) {
 
    console.log(res)
 
},
 
fail: function (err) {
 
    console.log(err)
 
}
 
})
 
},

但是提示错误

errMsgrequestSubscribeMessage:fail can only be invoked by user TAP gesture.

这是为什么???

1 回复
yang68
yang681 楼6 年前

只能在bindtap事件中调用