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

z-filter-search

v0.0.7

Published

搜索组件

Readme

搜索组件

组件使用示例- 参考配置

<template>
 <div>
   <z-filtersearch v-model="form"   ref="dom" :col="8" :gutter="10" :options="list" @reset="handleReset" @confirm="handleConfirm">
     <template #ELINPUT:name:append>
       {{ h1 }}
     </template>
     <template #ELINPUT:firstName:append>
       {{ h1 }}
     </template>
     <template #ZSLIDESELECT:slideselect:default>
         <el-option

             v-for="item in list[0].componentAttrs.list"
             :key="item.value"
             :label="item.label"
             :value="item.value"
             />
         </template>
     <template #ELSELECT:option:default>
       <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
     </template>
   </z-filtersearch>
 </div>
</template>

<script setup lang="ts">
import { ref, h,  onMounted, reactive, watch } from "vue";
const h1 = ref("A");
const dom = ref()
const options = [
 {
   value: "Option1",
   label: "Option1",
 },
 {
   value: "Option2",
   label: "Option2",
 },
];
let form = ref({
 name: '测试form建立',
 firstName: '2',
 slideselect: [1, 5],
 option: 'option2',
 'date-picker': new Date(),
 slider: 3,
 "time-picker": new Date(),
 switch: false
})
let list = ref([
{
   type: "z-slideselect",
   key: "slideselect",
   label: "自定义",
   labelWidth: "60px",
   componentAttrs: {
     placeholder: '自定义组件',
     list: [{label: '1-2', value: '1-2'}, {label: '2-3', value: '2-3'}],
     step: 1,
     min: 1,
     max: 5,
     useUnits: false,
     unit: []
   },
   slots: ["default"],
   componentSlot: {
   //   prepend: h("div", {}, "前"),
   },
   componentEvent: {
     clear: (e: any) => {
       console.log(e, "clear");
     },
     change: (e: any) => {
       console.log(e, "change");
     },
     input: (e: any) => {
       console.log("----", e);
     },
   },
 },
 {
   type: "el-input",
   key: "name",
   label: "名称",
   labelWidth: "60px",
   componentAttrs: {
     type: "text",
     value: "",
   },
   slots: ["append"],
   componentSlot: {
     prepend: h("div", {}, "前"),
   },
   componentEvent: {
     blur: (e: any) => {
       console.log(e, "blur");
     },
     input: (e: any) => {
       console.log("----", e);
     },
   },
 },
 {
   type: "el-input",
   key: "firstName",
   label: "名称1",
   componentAttrs: {
     type: "text",
     value: "",
   },
   slots: ["append"],
   componentSlot: {
     prepend: h("div", {}, "前"),
   },
   componentEvent: {
     blur: (e: any) => {
       console.log(e, "blur");
     },
     input: (e: any) => {
       console.log("----", e);
     },
   },
 },
 {
   type: "el-select",
   key: "option",
   componentAttrs: {
     value: "Option2",
   },
   slots: ["default"],
   componentSlot: {
     prefix: h("div", {}, "前"),
   },
   componentEvent: {
     blur: (e: any) => {
       console.log(e, "blur");
     },
     input: (e: any) => {
       console.log("----", e);
     },
   },
 },
 {
   type: "el-slider",
   key: "slider",
   componentAttrs: {
     value: 3,
     step: 1,
     min: 1,
     max: 10,
   },
   componentSlot: {},
   componentEvent: {
     change: (e) => {
       console.log(e, "change");
     },
     input: (e) => {
       console.log("----", e);
     },
   },
 },
 {
   type: "el-switch",
   key: "switch",
   labelWidth: "140px",
   label: "填充一下比较好看",
   componentAttrs: {
     value: false,
     style: "--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949",
   },
   componentSlot: {},
   componentEvent: {
     change: (e: any) => {
       console.log(e, "change");
     },
   },
 },
 {
   type: "el-time-picker",
   key: "time-picker",
   componentAttrs: {
     value: new Date(),
     placeholder: "时间",
   },
   componentSlot: {},
   componentEvent: {
     change: (e: any) => {
       console.log(e, "change");
     },
   },
 },
 {
   type: "el-date-picker",
   key: "date-picker",
   componentAttrs: {
     value: new Date(),
     placeholder: "时间",
     shortcuts: [
       {
         text: "Today",
         value: new Date(),
       },
       {
         text: "Yesterday",
         value: () => {
           const date = new Date();
           date.setTime(date.getTime() - 3600 * 1000 * 24);
           return date;
         },
       },
     ],
   },
   componentSlot: {},
   componentEvent: {
     change: (e: any) => {
       console.log(e, "change");
     },
   },
 },
]);


const handleReset = (oldform: any) => {

 console.log(oldform,  form)
}
const handleConfirm = () => {
 console.log(form, 'handleConfirm', dom.value)
}



</script>

搜索组件属性

| 属性 | 描述 | 备注 | | --------------- | :-------------------- | :---------------------: | | gutter | 组件间隔 | number | | onFilter | labelWidth提示宽度,已配置label有效 | string | | options | 组件配置列表 | 参考element plus component Extra Attr | | col | 平铺个数 | 以24格切分 | | showDown | 未支持 | | | confirmText | 确认文案 | string | | resetText | 重置文案 | string | | showConfirm | 是否展示确认 | boolean | | showReset | 是否展示重置 | boolean |

element plus 组件额外添加的属性 - Array item

| 属性 | 描述 | 备注 | | --------------- | :------------ | :----------: | | type | 对应各类element form组件 | string | | key | 对应参数key | string | | label | 输入提示 | string非必填 | | componentAttrs | element-plus 组件配置 | Object | | labelWidth | string 提示宽度 | string 非必填 | | componentEvent | element-plus 组件配置 | Object 查看 element-plus| | componentSlot | element-plus 组件slot配置 | Object | | slots | slot name对应拓展,参考实例 | Array[string] |

ref defineExpose 方法

| 方法 | 描述 | 备注 | | --------------- | :------------ | :----------: | | onReset | 重置 | Function | | onConfirm | 确定 | Function |

ref defineExpose 属性

| 方法 | 描述 | 备注 | | --------------- | :------------ | :----------: | | form | 返回表单选择结果 | Object |

组件事件

| | 描述 | 备注 | | --------------- | :------------ | :----------: | | change | 筛选变化 | 返回表单选择结果 | | reset | 重置 | 返回表单选择结果 | | confirm | 确认 | 返回表单选择结果 | | update | 更新 | 返回表单选择结果 |