微信小程序一次性订阅,前端代码

第一步:login.xml里面写一个button

<view class="form-page">

<button type="primary" bindtap="subscribe" >Submit2</button>

</view>

第二步:login.js里面实现代码:

subscribe:function(e){

    //订阅

    wx.requestSubscribeMessage({

      tmplIds: ['这里写模板ID'],

      success:function(res) {

        console.log("res=", res);

      },

      fail:function(res){

        console.log("res=",res);

      }

    })

  },

第三步:真机调试

完成。

发布了5 篇原创文章 · 获赞 0 · 访问量 690

猜你喜欢

转载自blog.csdn.net/yeZhuShanCun/article/details/102823194
今日推荐