element ui表格實現(xiàn)下拉篩選功能
本文實例為大家分享了element ui表格實現(xiàn)下拉篩選的具體代碼,供大家參考,具體內(nèi)容如下
1、default-sort中prop傳入要排序的字段(接口返回或自己定義的數(shù)據(jù))、order代表排序,這里用到降序
2、filters對象中text代表頁面中顯示的篩選文字,value代表篩選用到的值,在方法中filterHandler用到
3、column 的 key,如果需要使用 filter-change 事件,則需要此屬性標(biāo)識是哪個 column 的篩選條件(綁定的是要對接口中排序的字段)
4、數(shù)據(jù)過濾的選項是否多選(multiple代表是否查詢多條)
5、fliter-methods:數(shù)據(jù)過濾使用的方法,如果是多選的篩選項,對每一條數(shù)據(jù)會執(zhí)行多次,任意一次返回 true 就會顯示。參數(shù)為value, row, column
<template> <el-table :data="tableData" style="width: 100%" empty-text="暫無數(shù)據(jù)" ref="filterTable" > <el-table-column prop="deviceType" label="設(shè)備類型" show-overflow-tooltip column-key="deviceType" :filters="[ { text: '氣象設(shè)備', value: 1 }, { text: '墑情設(shè)備', value: 0 }, ]" :filter-method="filterHandler" :filter-multiple="true" > <template slot-scope="scope"> <span v-if="scope.row.deviceType == 1">氣象監(jiān)測設(shè)備</span> <span v-if="scope.row.deviceType == 0">墑情監(jiān)測設(shè)備</span> <span></span> </template> </el-table-column> </el-table> </template> methods: { // 表頭過濾事件 filterHandler(value, row, column) { const property = column["property"]; return row[property] === value; } }
數(shù)據(jù)類型
頁面效果
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- element-ui中的select下拉列表設(shè)置默認(rèn)值方法
- 淺談Vue Element中Select下拉框選取值的問題
- 解決element-ui中下拉菜單子選項click事件不觸發(fā)的問題
- 解決element ui select下拉框不回顯數(shù)據(jù)問題的解決
- vue+Element中table表格實現(xiàn)可編輯(select下拉框)
- vue+element搭建后臺小總結(jié) el-dropdown下拉功能
- 詳解element-ui設(shè)置下拉選擇切換必填和非必填
- 解決element-ui里的下拉多選框 el-select 時,默認(rèn)值不可刪除問題
- Element Dropdown下拉菜單的使用方法
- Vue+Element UI 樹形控件整合下拉功能菜單(tree + dropdown +input)
相關(guān)文章
vue-router實現(xiàn)webApp切換頁面動畫效果代碼
本篇文章主要介紹了vue實現(xiàn)app頁面切換效果實例代碼,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-05-05Vue?Router?實現(xiàn)登錄后跳轉(zhuǎn)到之前想要訪問的頁面
這篇文章主要介紹了Vue?Router?實現(xiàn)登錄后跳轉(zhuǎn)到之前相要訪問的頁面,本文僅演示路由跳轉(zhuǎn)和導(dǎo)航守衛(wèi)相關(guān)代碼的實現(xiàn),不包含具體的權(quán)限驗證和登錄請求,需要的朋友可以參考下2022-12-12