├── .gitignore
├── README.md
├── babel.config.js
├── package.json
├── public
├── favicon.ico
├── image
│ ├── filterTable.gif
│ └── project.gif
└── index.html
├── src
├── App.vue
├── assets
│ └── logo.png
├── components
│ ├── Example.vue
│ └── FilterTable.vue
├── main.js
└── plugins
│ └── iview.js
└── yarn.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 |
14 | # Editor directories and files
15 | .idea
16 | .vscode
17 | *.suo
18 | *.ntvs*
19 | *.njsproj
20 | *.sln
21 | *.sw*
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # iview-filter-table
2 |
3 | > 一个基于iView Table 的带搜索过滤的Table组件, 支持 `Input`输入框 和 `Select`下拉框两种表格筛选方式.
4 |
5 | 
6 |
7 | ## 使用
8 | **模板**:
9 | ```html
10 |
13 |
14 | ```
15 | **列描述数据对象:**
16 | ```js
17 | tableColumns: [
18 | {
19 | title: '用户名',
20 | key: 'username',
21 | filter: {
22 | type: 'Input' //输入框过滤
23 | }
24 | },
25 | {
26 | title: '状态',
27 | key: 'status',
28 | filter: {
29 | type: 'Select',//下拉框过滤
30 | option: userStatus //下拉框选项数据对象
31 | }
32 | }
33 | ]
34 | ```
35 | **下拉框选项数据格式:**
36 | ```js
37 | const userStatus = {
38 | 0: {
39 | value: 0,
40 | name: '全部'
41 | },
42 | 1: {
43 | value: 1,
44 | name: '已锁定',
45 | color: 'red'
46 | },
47 | 2: {
48 | value: 2,
49 | name: '正常',
50 | color: 'green'
51 | },
52 | };
53 | ```
54 | **触发搜索事件:**
55 |
56 | ```js
57 | onSearch(search) {
58 | //模拟数据库查询数据
59 | //这个search应该是传到后台,然后台来根据条件查询数据库
60 | alert('查询条件:'+JSON.stringify(search,null,4));
61 | }
62 | ```
63 |
64 | 在该方法中进行条件过滤,更新组件 `data` 属性的值。
65 |
66 | 直接运行该项目可以看当前组件的Example效果。
67 |
68 | 
69 |
70 | ## Project setup
71 | ```
72 | yarn install
73 | ```
74 |
75 | ### Compiles and hot-reloads for development
76 | ```
77 | yarn run serve
78 | ```
79 |
80 | ### Compiles and minifies for production
81 | ```
82 | yarn run build
83 | ```
84 |
85 | ### Run your tests
86 | ```
87 | yarn run test
88 | ```
89 |
90 | ### Lints and fixes files
91 | ```
92 | yarn run lint
93 | ```
94 |
95 | ### Customize configuration
96 | See [Configuration Reference](https://cli.vuejs.org/config/).
97 |
98 | **Github源码地址**
99 | https://github.com/azhengyongqin/iview-filter-table
100 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/app'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "iview-filter-table",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "serve": "vue-cli-service serve",
7 | "build": "vue-cli-service build"
8 | },
9 | "dependencies": {
10 | "iview": "^3.0.1",
11 | "vue": "^2.5.22"
12 | },
13 | "devDependencies": {
14 | "@vue/cli-plugin-babel": "^3.4.0",
15 | "@vue/cli-service": "^3.4.0",
16 | "vue-cli-plugin-iview": "^1.0.6",
17 | "vue-template-compiler": "^2.5.21"
18 | },
19 | "postcss": {
20 | "plugins": {
21 | "autoprefixer": {}
22 | }
23 | },
24 | "browserslist": [
25 | "> 1%",
26 | "last 2 versions",
27 | "not ie <= 8"
28 | ]
29 | }
30 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhengyongqin/iview-filter-table/35e7d5eb8fea48fcf9898b8b2aa493198799617d/public/favicon.ico
--------------------------------------------------------------------------------
/public/image/filterTable.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhengyongqin/iview-filter-table/35e7d5eb8fea48fcf9898b8b2aa493198799617d/public/image/filterTable.gif
--------------------------------------------------------------------------------
/public/image/project.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhengyongqin/iview-filter-table/35e7d5eb8fea48fcf9898b8b2aa493198799617d/public/image/project.gif
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | iview-filter-table
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
16 |
17 |
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhengyongqin/iview-filter-table/35e7d5eb8fea48fcf9898b8b2aa493198799617d/src/assets/logo.png
--------------------------------------------------------------------------------
/src/components/Example.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
10 |
153 |
154 |
--------------------------------------------------------------------------------
/src/components/FilterTable.vue:
--------------------------------------------------------------------------------
1 |
2 |
18 |
19 |
20 |
161 |
162 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import './plugins/iview.js'
4 |
5 | Vue.config.productionTip = false
6 |
7 | new Vue({
8 | render: h => h(App),
9 | }).$mount('#app')
10 |
--------------------------------------------------------------------------------
/src/plugins/iview.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import iView from 'iview'
3 |
4 | Vue.use(iView)
5 |
6 | import 'iview/dist/styles/iview.css'
7 |
--------------------------------------------------------------------------------