Git Product home page Git Product logo

china-division's Introduction

@pansy/china-division

基于china-division, 提供**省市区数据并提供相应的工具方法

提供两种数据格式

  • { v: string; n: string; c: {...}[] }
  • { label: string; value: string; children: {...}[] } 适用于Antd级联选择组件

如有更新数据的需求,请修改china-division版本,执行npm run export:data即可。

✨ 特性

  • 🌈 基于china-division,提供了香港、澳门、**的数据
  • 💻 使用 TypeScript 编写,提供完善的类型定义
  • 🌴 提供jsjson两种数据引用方式

🏗 安装

# yarn
yarn add @pansy/china-division

# npm
npm install @pansy/china-division --save

# pnpm 
pnpm add @pansy/china-division

🔨 使用

// Antd Cascader组件使用
import cascaderOptions, { DivisionUtil } from '@pansy/china-division';

const divisionUtil = new DivisionUtil(cascaderOptions);

// 返回源数据
divisionUtil.getSourceData(); 

// 返回省级别数据
divisionUtil.getProvinces(); 

// 返回指定Code的所有子节点
divisionUtil.getChildrenByCode('110000'); 

// 返回指定Code的名称
divisionUtil.getNameByCode('110000'); 

// 返回指定Code的节点
divisionUtil.getDivisionByCode('110000'); 

⌨️ 本地开发

$ git clone [email protected]:pansyjs/china-division.git
$ cd ./china-division
# 安装依赖
$ pnpm install
# 导出数据
$ npm run export
# 运行测试用例
$ npm run test
# 编译项目
$ npm run build

🌟 社区互助

Github Issue 钉钉群 微信群
issues

china-division's People

Contributors

wangxingkang avatar renovate-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.