# el-query-filter **Repository Path**: hrxt/el-query-filter ## Basic Information - **Project Name**: el-query-filter - **Description**: 基于element-ui的自定义多条件查询组件 - **Primary Language**: JavaScript - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2024-04-03 - **Last Updated**: 2024-04-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # el-query-filter #### 介绍 基于element-ui的自定义多条件查询组件。对于大多数业务,查询数据时都需要提前构建许多字段输入框用于查询,这是一件非常繁琐且麻烦的时候,所以开发此组件,方便用户自定义查询的字段。 #### 所需依赖 由于该组件基于element-ui开发,请先加入element-ui插件。 [具体请看Element官网文档]([组件 | Element](https://element.eleme.cn/#/zh-CN/component/installation)) #### 安装教程 ``` bash npm install el-query-filter ``` #### 使用说明 在main.js中写入以下内容: ```javascript import Vue from 'vue'; // 载入Element-ui插件 import ElementUI from 'element-ui'; import 'element-ui/lib/theme-chalk/index.css'; // 载入el-query-filter组件 import ElQueryFilter from 'el-query-filter'; import App from './App.vue'; Vue.use(ElementUI); // 使用el-query-filter组件 Vue.component(ElQueryFilter.name, ElQueryFilter); new Vue({ el: '#app', render: h => h(App) }); ``` 以上代码便完成了 Element 以及el-query-filter的引入。 ## el-query-filter Attributes | 参数 | 说明 | 类型 | 可选值 | 默认值 | | :-----------: | :----------------------------- | :-----: | :-------------------: | :----: | | modal | 是否需要遮罩层 | boolean | — | false | | direction | Drawer 打开的方向 | string | rtl / ltr / ttb / btt | ttb | | maxQueryCount | 最大查询条数量 | number | — | 5 | | isShow | 是否显示 ,支持 .sync 修饰符 | boolean | — | false | | options | 请参考 el-query-filter Options | object | | | ## el-query-filter Options | 参数 | 说明 | 类型 | 例子 | | :-------: | :--------------: | :------: | ------------------------------------------------------------ | | fields | 字段对象数组 | object[] | [{ label: "姓名", value: "name" },{ label: "年龄", value: "age" }] | | operators | 操作符对象数组 | object[] | [{ label: "=", value: "eq" },{ label: ">", value: "gt" }] | | logics | 逻辑符号对象数组 | object[] | [{ label: "且", value: "and" },{ label: "或", value: "or" }] | ## Events | 事件名称 | 说明 | 回调参数 | | -------- | -------------------- | ------------------------------ | | confirm | 查询确认按钮回调事件 | 返回用户输入查询条件,json格式 | ## 使用实例 ```vue ```