微信小程序获取formId

在pick中获取:

<picker bindchange="sexPickerChange"value="{{indexSex}}"name="indexSex"range="{{arraySex}}"class="ui-width-70">
<view style="color:{{coatLengthColor}}" class="ui-flex picker-select ui-padding-10">
<view class="ui-width-100">
<form bindsubmit="submitInfo" report-submit='true' >
<button form-type="submit">
<text>{{arraySex[indexSex]}}</text>
</button>
</form>
</view>
<imageclass="select-img"src="../../../image/select.png"></image>
</view>
</picker>

在input中获取:

<form bindsubmit="submitInfo" report-submit='true' >
<button form-type="submit">
<view class="userName">
<text>数据</text>
<input name="getNum"value="{{num}}"placeholder="请输入数据"class="username"/>
</view>
</button>
</form>

获取方法:

 

submitInfo: function (e) {
console.log('GG 敌方军团已同意投降 4票赞成 0票反对')
console.log(e.detail.formId);
},

 

 

这个e.detail.fromId,就是formid,真机才会产生,模拟器中为‘’the formId is a mock one‘’

 

使用这个formId推送模板消息可以看https://blog.csdn.net/u010481239/article/details/82884870


版权声明:本文为u010481239原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。