关于element-ui 里 对表格进行筛选,可快速查找到自己想看的数据。
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element

·
这两天在搞一个项目的时候,遇到一个问题,对表格的数据进行筛选,按照官网上,怎么就是实现不了,找了很多帖子也都没有过多的讲解,发愁。。。。 再愁也要去解决不是,然后重新仔细阅读官网上的介绍,一步步推翻重新来,终于让我找到了原因所在 废话不说,直接上代码
//首先我们要写下筛选的条件,:fillters=[这里就是筛选条件,写在data里声明也是可以的
<el-table-column
prop="account_type"
label="账户种类"
column-key="name"
:filters="[{ value: 0,text: '正常账户'},{value: 1, text: 'AR账户' }]"
:filter-method="filterHandlers">
<template slot-scope="scope">
<span v-if="scope.row.account_type === 1">AR账户</span>
<span v-else>正常账户</span>
</template>
</el-table-column>
//然后就是事件了
filterHandlers(value, row, column) {
console.log(value, row, column);
let property = column['property'];
return row.account_id[property] === value; 这里就是选中的条件所需要的value值
},
// return 的数据 也就是row.account_id.account_type=value; 相当于上述代码里的account_type的判断条件然后这样一切搞定了。。。。
**前端小白---的爬坑之路 ,如有不对之处请多指教**




A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:2 天前 )
c345bb45
1 年前
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 1 年前
更多推荐
所有评论(0)