编程语言
首页 > 编程语言> > 微信小程序手机FormId

微信小程序手机FormId

作者:互联网

直接上图,关键点,report-submit属性一定要加上

JS文件中代码:

formSubmit:function(e){
    // 监听提交事件,获取e.detail
    console.log(e.detail);
}

图例展示:(小程序模拟器上给的是假的formid)

html:

<form report-submit='true' bindsubmit='hideSubmit'>
    <button form-type='submit' plain='true' >formid按钮</button>
</form>

 js封装:

//埋点formid
  hideSubmit: function (e) {
    wx.request({
      url: app.globalData.apiUrl + '/appletuser/collectAppletFormId',
      data: {
        openid: wx.getStorageSync('globalOpenid'),
        unionid: wx.getStorageSync('globalUnionid'),
        formid: e.detail.formId
      },
      success: res => {
        console.log(res);
      }
    })
  },

 

标签:console,log,微信,程序,detail,formid,res,FormId,wx
来源: https://blog.csdn.net/weixuefeiQQ/article/details/93481498