:cn: Element UI && antd Cascader级联选择器 中国省市区三级、二级联动option数据
Last updated Jul 2, 2026
1.3k
Stars
216
Forks
15
Issues
+2
Stars/day
Attention Score
38
Topics
Language breakdown
TypeScript 92.9%
HTML 5.9%
Shell 1.1%
▸ Files
click to expand
README
Element UI 中国省市区级联数据
演示效果 gif

安装
npm install element-china-area-data -S
import 使用
import {
provinceAndCityData,
pcTextArr,
regionData,
pcaTextArr,
codeToText,
} from "element-china-area-data";
provinceAndCityData省市二级联动数据,汉字+coderegionData省市区三级联动数据pcTextArr省市联动数据,纯汉字pcaTextArr省市区联动数据,纯汉字codeToText是个大对象,属性是区域码,属性值是汉字 用法例如:codeToText['110000']输出北京市
- 省市二级联动:
<template>
<div id="app">
<el-cascader
size="large"
:opti
v-model="selectedOptions">
</el-cascader>
</div>
</template>
- 省市二级联动,纯汉字:
<template>
<div id="app">
<el-cascader
size="large"
:opti
v-model="selectedOptions">
</el-cascader>
</div>
</template>
- 省市区三级联动
<template>
<div id="app">
<el-cascader
size="large"
:opti
v-model="selectedOptions">
</el-cascader>
</div>
</template>
- 省市区三级联动,纯汉字
<template>
<div id="app">
<el-cascader
size="large"
:opti
v-model="selectedOptions">
</el-cascader>
</div>
</template>
script 引入
v6 改动
- 改用全新脚手架构建,同时支持 CommonJS 和 ESM modules
- 去掉了 provinceAndCityDataPlus/regionDataPlus/TextToCode,全选功能请利用级联组件自身的
- CodeToText 修改为 codeToText
- 添加了纯汉字的数据对象 pcTextArr 和 pcaTextArr
- 不再支持港澳台,使用新的数据源https://github.com/modood/Administrative-divisions-of-China
旧版本 v5.0.2
数据来源
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
🔗 More in this category