China Area Data
Convert Vant Area into Element UI Cascader Component data format.
Install
npm i @byronvis/china-area-data -D
Usage
Via commonjs
const getAreaTree = require("@byronvis/china-area-data").getAreaTree;
const areaList = getAreaTree();
Via cdn
<script src="https://cdn.jsdelivr.net/npm/@byronvis/china-area-data/dist/index.umd.js"></script>
<script>
const getAreaTree = ChinaAreaData.getAreaTree;
const areaList = getAreaTree();
</script>
Output
[
{
label:'北京市',
value:'110000',
children:[
{
label:'北京市',
value:'110100',
children:[
{
lable:'东城区',
value:'110101'
},
...
]
},
...
]
},
...
]
Methods
getAreaTree(addAll:boolean)
parameters:
- addAll:false