vue,computed,计算属性
用法:
computed: {
didiFamily: {
// getter
get: function () {
return this.data_i + ' ' + this.data_f
},
// setter
set: function (newValue) {
// 被赋值,将被调用
console.log(newValue)
this.data_i = id
this.data_f = from
}
}
}
过滤作用
computed: {
seatDataFilter () {
let seatData = JSON.parse(JSON.stringify(this.seatDataState))
for (let i = 0; i < seatData.length; i++) {
const element = seatData[i]
element.seen = false
}
return seatData
}
}