data:里的写法
data: {
noChoose:
false,
components: [{ name:
"长留教育", change:
false },
{ name:
"画画教育", change:
false },
{ name:
"花花教育", change:
false },
{ name:
"花花教育", change:
false }
],
},
调用函数的写法:
onDte:
function () {
const that =
this;
const arr = []
const noChoose = that.data.noChoose;
that.setData({
noChoose: noChoose?
false:
true
})
for (
let i =
0; i < that.data.components.length; i++) {
if (!that.data.components[i].change) {
arr.push(that.data.components[i])
}
};
that.setData({
components: arr
})
console.log(that.data.components.length)
},