@byronvis/china-area-data
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

China Area Data

NPM version David deps License

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

Package Sidebar

Install

npm i @byronvis/china-area-data

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

273 kB

Total Files

15

Last publish

Collaborators

  • zenonux