MCPcopy Index your code
hub / github.com/Plortinus/element-china-area-data

github.com/Plortinus/element-china-area-data @6.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 6.1.0 ↗ · + Follow
5 symbols 14 edges 5 files 0 documented · 0% updated 2y ago6.1.0 · 2023-09-13★ 1,34815 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Element UI 中国省市区级联数据

npm npm GitHub top language npm bundle size GitHub

演示效果 gif

20230508-093525

v6 改动

  1. 改用全新脚手架构建,同时支持 CommonJS 和 ESM modules
  2. 去掉了 provinceAndCityDataPlus/regionDataPlus/TextToCode,全选功能请利用级联组件自身的
  3. CodeToText 修改为 codeToText
  4. 添加了纯汉字的数据对象 pcTextArr 和 pcaTextArr
  5. 不再支持港澳台,使用新的数据源https://github.com/modood/Administrative-divisions-of-China

旧版本 v5.0.2

文档地址

安装

npm install element-china-area-data -S

在线示例

import 使用

import {
  provinceAndCityData,
  pcTextArr,
  regionData,
  pcaTextArr,
  codeToText,
} from "element-china-area-data";
  1. provinceAndCityData省市二级联动数据,汉字+code
  2. regionData省市区三级联动数据
  3. pcTextArr省市联动数据,纯汉字
  4. pcaTextArr省市区联动数据,纯汉字
  5. codeToText是个大对象,属性是区域码,属性值是汉字 用法例如:codeToText['110000']输出北京市

  6. 省市二级联动:

```js

```

  • 省市二级联动,纯汉字:

```js

```

  • 省市区三级联动

```js

```

  • 省市区三级联动,纯汉字

```js

```

script 引入

<script src="https://unpkg.com/element-china-area-data@6.0.0/dist/element-china-area-data.iife.js"></script>
<script>
  new Vue({
    el: "#app",
    data: function () {
      return {
        codeToText: elementChinaAreaData.codeToText,
        provinceAndCityData: elementChinaAreaData.provinceAndCityData,
        pcTextArr: elementChinaAreaData.pcTextArr,
        regionData: elementChinaAreaData.regionData,
        pcaTextArr: elementChinaAreaData.pcaTextArr,
        selectedOptions1: ["11", "110101"],
        selectedOptions2: ["12", "1201", "120101"],
        selectedOptions3: ["北京市", "朝阳区"],
        selectedOptions4: ["北京市", "市辖区", "朝阳区"],
      };
    },
  });
</script>

数据来源

Administrative-divisions-of-China

开发测试命令

  • dev - starts dev server
  • build - generates the following bundles: CommonJS (.cjs) ESM (.mjs) and IIFE (.iife.js). The name of bundle isautomatically taken from package.json name property
  • test - starts vitest and runs all tests
  • test:coverage - starts vitest and run all tests with code coverage report
  • lint:scripts - lint .ts files with eslint
  • lint:styles - lint .css and .scss files with stylelint
  • format:scripts - format .ts, .html and .json files with prettier
  • format:styles - format .cs and .scss files with stylelint
  • format - format all with prettier and stylelint
  • prepare - script for setting up husky pre-commit hook
  • uninstall-husky - script for removing husky from repository

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Function 4
Interface 1

Languages

TypeScript100%

Modules by API surface

vite.config.ts2 symbols
src/index.ts2 symbols
dts-bundle-generator.config.ts1 symbols

For agents

$ claude mcp add element-china-area-data \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page