第一步: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);
}
})
},
第三步:真机调试
完成。