Element-ui table中过滤条件变更表格内容
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
免费下载资源
·
组件中:
<el-table :data="users" highlight-current-row v-loading="listLoading" style="width: 100%;">
<el-table-column prop="sex" label="性别" width="100" :formatter="formatSex" sortable>
</el-table-column>
<el-table-column prop="cz" label="操作" width="320">
<template scope="scope">
<el-button size="small"
@click="handleEdit(scope.$index, scope.row)">编辑
</el-button>
<el-button size="small" @click="handleEdit(scope.$index, scope.row)">
{{scope.row.status | formatStatus}}
</el-button>
</template>
</el-table-column>
</el-table>
js中:
filters: {
formatStatus: function (val) {
console.log(val)
return val == 1 ? '上架' : val == 2 ? '下架' : '未知';
},
},
methods: {
//性别显示转换
formatSex: function (row, column) {
return row.sex == 1 ? '男' : row.sex == 0 ? '女' : '未知';
},
}
GitHub 加速计划 / eleme / element
54.06 K
14.63 K
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:3 个月前 )
c345bb45
7 个月前
a07f3a59
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update table.md
* Update transition.md
* Update popover.md 7 个月前
更多推荐
已为社区贡献10条内容
所有评论(0)