vue-dictionary
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

VueDictionary

一个后台管理系统通用的字典数据组件
文档

安装

npm i vue-dictionary
# or
yarn add vue-dictionary

使用

全部引入

import { createApp } from "vue";
import App from "./App.vue";
import VueDictionary from "vue-dictionary";

const app = createApp(App);

// global config
const getDict = (type: string) => axios.get("/api/dict/" + type);
app.use(VueDictionary, {
  label: "title",
  value: "id",
  children: "child",
  request: getDict,
  res: "res.data"
});

app.mount("#app");

手动引入

<!-- App.vue -->
<template>
  <v-dict type="select" :data="[]"></v-dict>
  <!-- Same As -->
  <dict-select :data="[]"></dict-select>
</template>
<script setup>
  import { VDict, DictSelect } from "vue-dictionary";
</script>

Volar 支持

tsconfig.json 中为 Volar 添加类型定义

// tsconfig.json
{
  "compilerOptions": {
    // ...
    "types": ["vue-dictionary/global"]
  }
}

Readme

Keywords

Package Sidebar

Install

npm i vue-dictionary

Weekly Downloads

0

Version

2.1.0

License

MIT

Unpacked Size

182 kB

Total Files

134

Last publish

Collaborators

  • soullyoko