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