1. vue修改对象的属性后页面的数据没有刷新
动态修改页面的属性不能用点属性的形式,数据刷新了但是页面不会重新渲染。动态的修改对象属性需要使用$set
this.tableData[id].red=true; //错误方式
this.$set(this.tableData[id],"red",true); //正确的方法
2. 表格的多选框的全选
要实现的功能是在表格的下边加上全选按钮,实现全选和取消全选的功能。在el-table标签上加上 ref="multipleTable",在操作的时候判断列表数据是否已经全选中
toggleSelecAll(rows) { if (uuidList.length < this.tableData.length) { rows.forEach(row => { this.$refs.multipleTable.toggleRowSelection(row, true); //小于表格的长度就选中 }); } else { rows.forEach(row => { this.$refs.multipleTable.toggleRowSelection(row, false); //否则反选 }); } },
3. 单元格里的数据传参数
element中事件有默认的参数,如果想传其他参数可以在行内写
:before-upload="((file) => { beforeBaseUpload(file, scope.row.starId)})"
//默认参数 //默认参数和其他的参数
4. axios