# shu-c-data-dict

> 一个 Javascript 封装的全局数据过滤转换器

Latest version **1.0.2** (published 2021-12-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install shu-c-data-dict
pnpm add shu-c-data-dict
yarn add shu-c-data-dict
bun add shu-c-data-dict
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-12-23 |
| First published | 2021-07-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 108.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | zhangh |
| Maintainers | zhangh-design |
| Keywords | echarts |

## Links

- npm: https://www.npmjs.com/package/shu-c-data-dict
- npm.io page: https://npm.io/package/shu-c-data-dict

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2021-12-23
- 1.0.1 — 2021-07-14
- 1.0.0 — 2021-07-14

## README

##  shu-c-data-dict

<p align="center">
  <a href="#">
    <img src="https://img.shields.io/badge/build-passing-brightgreen.svg" alt="build">
  </a>
  <a href="#">
    <img src="https://img.shields.io/badge/npm-v1.0.0-blue.svg" alt="npm">
  </a>
  <a href="#">
    <img src="https://img.shields.io/badge/vue: - 2.6.13 -brightgreen.svg" alt="vue">
  </a>
  <a href="#">
    <img src="https://img.shields.io/badge/gzip--size: JS- 9.86 KB-brightgreen.svg" alt="">
  </a>
</p>


### 全局数据过滤转换器

安装和快速上手

npm 安装

> 安装依赖包

- shuCDataDict

```javascript
npm i shu-c-data-dict --save
```

- vue

```javascript
npm i vue@2.6.13 --save
```

- lodash （帮助函数插件）

`lodash`如果使用的是脚手架那么可能脚手架已经帮你安装了（比如：Vue CLI）。

```javascript
npm i lodash --save
```


#### CDN

iife 格式未构建，请使用 webpack 和 npm 进行开发安装。


---

#### 快速上手

> 在 main.js 中写入以下内容：

```javascript
import Vue from 'vue';
import inject from "./inject.js";
import axios from "axios";

Vue.use(inject);
new Vue({
  mounted(){
    // 使用已经加载完成的 $dict 实例加载接口
    Vue.prototype.$dict.import(
      axios.get('/dict/getDictDataByTypeList')
    );
  },
  render: h => h(App)
}).$mount('#app')
```

> inject.js

```javascript
import { shuCDataDict } from '../components/shu-c-data-dict.cjs';

export default {
  install: (Vue, options = {}) => {
    Object.defineProperty(Vue.prototype, '$dict', {
      value: new shuCDataDict({ label: 'name', code: 'id' })
    });
  }
}
```

inject.js 中的 `{ label: 'name', code: 'id' }` 和数据字典中数据的 key 和 value 对应。

`'/dict/getDictDataByTypeList'` 接口数据格式：

```javascript
const aDictList = [
    {
      name: '融资产品类型',
      data: [
        { id: 1, name: '基金贷' },
        { id: 2, name: '基金担' },
        { id: 3, name: '基金租' },
        { id: 4, name: '基金联投' },
        { id: 5, name: '基金保' },
        { id: 6, name: '基金套保' }
      ]
    }
  ];
```

## Browsers support

Modern browsers and IE10.

| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Opera |
| --- | --- | --- | --- | --- |
| IE10, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |

last 2 versions 每个浏览器最新的两个版本

## Contributors

This project exists thanks to all the people who contribute. 

[zhangh-design](https://github.com/zhangh-design)

---
_Source: https://npm.io/package/shu-c-data-dict · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
