npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

el-query-filter

v1.0.1

Published

基于element-ui的自定义多条件查询组件

Readme

el-query-filter

介绍

基于element-ui的自定义多条件查询组件。对于大多数业务,查询数据时都需要提前构建许多字段输入框用于查询,这是一件非常繁琐且麻烦的时候,所以开发此组件,方便用户自定义查询的字段。

所需依赖

由于该组件基于element-ui开发,请先加入element-ui插件。 [具体请看Element官网文档](组件 | Element)

安装教程

npm install el-query-filter

使用说明

在main.js中写入以下内容:

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格式 |

使用实例

<template>
  <div id="app">
    <el-button @click="showQueryFilter = true">Show</el-button>
    <el-query-filter
      :isShow.sync="showQueryFilter"
      :options="queryFilterOptions"
      @confirm="confirmHandler"
    ></el-query-filter>
    <span>{{data}}</span>
  </div>
</template>

<script>
export default {
  name: "app",
  data() {
    return {
      data: "",
      showQueryFilter: true,
      // 查询条件
      queryFilterOptions: {
        fields: [
          { label: "姓名", value: "name" },
          { label: "年龄", value: "age" },
          { label: "手机号", value: "phone" },
        ],
        operators: [
          { label: "=", value: "eq" },
          { label: ">", value: "gt" },
          { label: "≥", value: "ge" },
          { label: "<", value: "lt" },
          { label: "≤", value: "le" },
        ],
        logics: [
          { label: "且", value: "and" },
          { label: "或", value: "or" },
        ],
      },
    };
  },
  methods: {
    confirmHandler(data) {
      this.data = data;
    }
  }
};
</script>