微信小程序获取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‘’
},

你可能感兴趣的:(微信小程序)