0.1.9 • Published 5 years ago

ad-filter v0.1.9

Weekly downloads
30
License
-
Repository
-
Last release
5 years ago

advanced-filter

安装

npm install ad-filter

引入

main.js

import AdFilter from 'ad-filter' 
import 'ad-filter/lib/ad-filter.css'

demo.vue

<template>
  <div id="app">
      <adFilter :config="tagTable" @doFilter="search" />
  </div>
</template>

Attributes

参数说明类型默认值
config配置项Array[]
separator多选状态下参数间的分隔符String;

Events

事件名称说明回调参数
doFilter点击筛选时触发导出的筛选参数(Object)

Config参数详解

参数示例:

[
	{
		key: 'type',
		content: '类型',
		multiple: true,
		type: 'select',
		separator: 'QQQ',
		color: 'red',
		background: '#0f0faa',
		options: [
			{
				label: '类型1',
				value: 'type1' 
			},
			{
				label: '类型2',
				value: 'type2' 
			}
		]
	},
	{
		key: 'status',
		content: '状态',
		multiple: false,
		type: 'select',
		options: [
			{
				label: '状态1',
				value: 'status1' 
			},
			{
				label: '状态2',
				value: 'status2' 
			}
		]
	},
	{
		key: 'keyword',
		content: '关键字',
		type: 'input'
	},
	{
		key: 'dateRange',
		content: '日期范围',
		type: 'dateRange',
		multiple: false
	},
	{
		key: 'date',
		content: '日期',
		type: 'date',
		multiple: true
	}
]

参数说明:

config数组中,每一个object都代表要配置的可供选择的参数项,object中参数具体解析如下:

config:
事件名称说明类型可选值
key筛选参数的key值(必须唯一)String
content该参数展示在组件上的名称String
type筛选项类型String"select","input","date","dateRange"
multiple是否多选Booleantrue、false (默认false)
separator多选时多个值之间的分隔符(仅在多选时有效)String在未指定时使用外部传入的attribute中公共的separator参数
options下拉选项(仅在type为"select"时可用)Array
color标签字体颜色(不设定则取用默认颜色)String
background标签背景色(不设定则取用默认颜色)String
type:
类型名称说明
select单选、多选类型筛选项,需配置options参数
input输入类型参数
date日期类型参数
dateRange日期范围类型参数
options:

options仅在type为select类型的选项中可用:

示例:
options: [
	{
		label: '状态1',
		value: 'status1' 
	},
	{
		label: '状态2',
		value: 'status2' 
	}
]
参数说明
label该选项展示的文字
value选项的值
0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago