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

@corgicoding-el/dict

v2.1.1

Published

基于element-plus的字典配合组件

Downloads

31

Readme

@corgicoding-el/dict

@corgicoding/web-quick-start 工程模板设定的远程字典组件,具备本地缓存功能

绑定依赖

  1. @corgicoding/web-types
    • NormalizedError: 统一错误返回
    • NormalizedResponse: 统一接口返回
  2. @corgicoding/axios-hook
    • useService: 获取当前 axios 实例

安装

安装工程到本地,并按需使用或全局使用

前置依赖

  • element-plus
  • axios
  • @vueuse/core
  • vue (3.x)

如果没有以上依赖,工程执行以下命令进行安装

pnpm install element-plus vue @vueuse/core axios -S

安装

使用 pnpm 下载

pnpm install @corgicoding-el/dict -S

使用

每次请求会访问当前 sessionStorage 缓存,查看当前访问字段是否缓存,是则取缓存内容,否则请求接口数据。

页面缓存仅当前标签页有效

props

export interface DictProps {
  dictCode: string; // 字典编码 或 表名
  valueKey?: string; // 若dictCode为表名,则需传入返回option取得value 数据库表头key
  textKey?: string; // 若dictCode为表名,则需传入返回option显示label 数据库表头key
  filter?: string; // 若dictCode为表名,则可输入过滤方法,例如 username='admin'
  url?: string; // 修改请求url
  modelValue: any; // 绑定值
  componentOptions?: any; // 配置默认element-plus组件参数
}

暴露参数

defineExpose({
  reload: forceReloadDict // 强制刷新字典缓存加载
});

用例参考

<script setup lang="ts">
import { computed } from 'vue';
import { DictSelect } from '@corgicoding-el/dict';

const selectValue = ref();
</script>

<template>
  <DictSelect v-model="selectValue" dict-code="rule_conditions"></DictSelect>
</template>