vue中使用el-table复选框选中不了
当
:data 使用 filter() 等方法返回新数组/新引用时,复选框会失效
解决方法:
- 不要在模板
:data里直接写 filter - 把过滤逻辑放到 computed 计算属性 里
- 用计算属性给表格绑定数据
<el-table ref="multipleTable" v-loading="tableLoading" :data="filteredTableData" > export default { data() { ... }, // 新增 —— 计算属性 computed: { // 过滤后的数据 filteredTableData() { return this.tableData_pp.filter(data => !this.search_pp || data.partNo.toLowerCase().includes(this.search_pp.toLowerCase()) || data.targetLocationNo.toLowerCase().includes(this.search_pp.toLowerCase()) || data.partDesc.toLowerCase().includes(this.search_pp.toLowerCase()) ) } }, methods: { ... } }

浙公网安备 33010602011771号