微信小程序、按钮、动态、添加、组件、控件
<view
class="page__bd">
<view
class="weui-article">
<buttonbindtap="insert">增加课程</button>
<buttonbindtap="delBind">删除课程</button>
<form
bindsubmit="formSubmit"
bindreset="formReset">
<view
wx:for="{{checkbox}}"
class="con">
<inputname="courseName{{index}}"class="input-address"maxlength="50"placeholder="课程名称(必填):"/>
<inputname="techerName{{index}}"class="input-address"maxlength="10"placeholder="老师名称(必填):"/>
<radio-groupname="radio{{index}}">
<label>
<radiovalue="A"
/>A</label>
<label>
<radiovalue="B"
/>B</label>
<label>
<radiovalue="C"
/>C</label>
</radio-group>
</view>
<buttonclass="weui-btn"type="primary"formType="submit">提交</button>
</form>
</view>
</view>
Page({
data: {
checkbox: [],
array: ['A',
'B', 'C'],
isReview: false,
isVerify: false,
},
insert: function () {
var cb = this.data.checkbox;
console.log(cb);
cb.push(this.data.checkbox.length);
this.setData({
checkbox: cb
});
},
delBind: function () {
var cb = this.data.checkbox;
console.log(cb);
cb.pop(this.data.checkbox.length);
this.setData({
checkbox: cb
});
},
})