elemnt的Table 表格使用注意事项
1、修改数据
<template slot-scope="scope"><el-button size="mini" @click='updatePassword(scope.row)'>修改密码</el-button><el-button size="mini" @click='resetPassword(scope.row)'>重置密码</el-button>
</template>
ps:此时的scope.row是一个对象,若直接修改会导致页面上的数据同时修改,建议使用 JSON.parse(JSON.stringify(data))对数据处理之后再进行处理,
2、对使用formatter格式化表格中的内容时
<el-table-column prop="recordTime" label="记录时间" min-width="20%" align="center" sortable :formatter="filterDate"></el-table-column>
filterDate: function(value) {
//此时的value是整行数据的对象,无法直接使用
},
建议使用此类方法,可以确保传入数据正确,不用后台再进行处理
<el-table-column align="center" label="日期" min-width="10%"><template slot-scope="scope"><span>{{filterDate(scope.row.updateTime)}}</span></template>
</el-table-column>