如何解决使用 wx-open-subscribe,用户允许后没有触发 success 事件的问题?

发布于 7 年前作者 jing219510 次浏览最后编辑 7 年前来自 ask

微信开放标签:wx-open-subscribe

问题1:config、ready 都正常执行,但是监听 `success` 事件,有时候第一次进入没有触发。求解答?

问题2:如何监听用户点击了订阅的事件?

多谢~

wx.config({
  debugfalse,
  appId: res.appId,
  timestamp: res.timestamp,
 nonceStr: res.nonceStr,
 signature: res.signature,
 jsApiList: res.jsApiList,
 openTagList: ['wx-open-subscribe']
});

wx.ready(() => {
  alert('ready');
 const btn = document.getElementById('subscribe-btn');
 btn.addEventListener('success'function(e{
  alert('btn', btn);
  });
  btn.addEventListener('error'function(e{
   console.log('fail', e.detail);
 });
});
0 回复
暂无回复