微信小程序、按钮、动态、添加、组件、控件
<
view
class=
"page__bd">
<
view
class=
"weui-article">
<
button
bindtap=
"insert">增加课程
</
button
>
<
button
bindtap=
"delBind">删除课程
</
button
>
<
form
bindsubmit=
"formSubmit"
bindreset=
"formReset">
<
view
wx:for=
"{{checkbox}}"
class=
"con">
<
input
name=
"courseName{{index}}"
class=
"input-address"
maxlength=
"50"
placeholder=
"课程名称(必填):"
/
>
<
input
name=
"techerName{{index}}"
class=
"input-address"
maxlength=
"10"
placeholder=
"老师名称(必填):"
/
>
<
radio-group
name=
"radio{{index}}">
<
label
>
<
radio
value=
"A"
/
>A
</
label
>
<
label
>
<
radio
value=
"B"
/
>B
</
label
>
<
label
>
<
radio
value=
"C"
/
>C
</
label
>
</
radio-group
>
</
view
>
<
button
class=
"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
});
},
})