vuejs怎样实现列表中checkbox的双向绑定及初始化渲染

如题所述

其实可以利用 filter , map 来轻松完成你要的功能
methods: {
getChecked: function() {
// 先透过 filter 筛选出 checked 为 true 的 item
// 在透过 map 只回传 item 的 value
return this.list.filter(item => item.checked).map(item => item.value)
}
}

实现
温馨提示:答案为网友推荐,仅供参考
相似回答