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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@yy-web/business-use

v2.0.8-beta.2

Published

yyweb business-use

Downloads

35

Readme

@yy-web/business-use

useSearch函数

该函数提供了一个搜索相关的逻辑封装,可以用于Vue.js的应用程序中。它接受一个泛型参数T和U,并根据传递的参数进行搜索并返回结果。函数主要功能包括:

  • 构建搜索参数
  • 调用搜索请求
  • 重置搜索表单
  • 导出搜索结果

函数参数

| 参数 | 类型 | 说明 | | - | - | - | | options | IUseSeachOptions<T, U> | 配置参数对象,包含以下属性 |

options参数属性

| 属性 | 类型 |默认值 | 说明 | | - | - | - | - | | initSearch | () => Partial<T & U> | () => ({}) as Partial<T & U>| 初始搜索表单值 | beforeSearch | (params?: Record<string, any>) => Record<string, any> | () => ({}) |构建搜索参数之前的钩子函数 | pageMethods | 'get' | 'post' | 'get' | 请求搜索接口的方式 |exportApi | MaybeComputedRef | undefined | 导出搜索结果接口路径 |handleSearch| (params: T & U) => void| undefined | 处理搜索请求结果的回调函数 |handleReset |() => void| () => ({}) |重置搜索表单的回调函数 |beforeExport |() => void| undefined |导出搜索结果之前的回调函数 |afterExport| () => void| undefined |导出搜索结果之后的回调函数 |firstLoad| boolean |true |是否在页面加载后首次执行搜索

函数返回值

|属性 | 类型 |说明 | - | - | - | |searchFlag | Ref| 搜索标志位,每次搜索时递增 |initForm| Ref<Partial>| 初始表单值的引用 |searchForm| Ref<Partial>| 搜索表单值的引用 |cacheSearch| Ref<Partial<U & T>> |缓存搜索表单值的引用 |exportLoading| Ref |导出结果时的加载状态 |searchParams |() => Record<string, any> |构建搜索参数的函数 |searchPage| () => void| 执行搜索的函数 |resetPage| () => void| 重置搜索表单并重新执行搜索的函数 |exportFile| () => Promise |导出搜索结果的函数 |confirmTable| (content: string, callback: () => PromiseLike, |cancelFn?: () => void) => void |显示模态对话框的函数,用于确认一些操作