GithubHelp home page GithubHelp logo

huanggligod / ydui-district Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ydcss/ydui-district

0.0 0.0 0.0 220 KB

Data of provinces, cities and counties in china. **省市县数据。

License: MIT License

JavaScript 100.00%

ydui-district's Introduction

ydui-district

**省市县数据:省份、城市、区县,共两种数据源8个版本

数据源各自优点

  • 京东数据源更灵活,更贴切实际,更详细,当然文件也相对大一点,ID为京东自己的算法;(例:北京 => 1, 上海 => 2)
  • 国家统计局数据,ID为区域代码,方便与其他数据源对应;(例:北京市 => 110000)

文件列表(京东触屏数据源)

文件名称 文件描述 文件大小
dist/jd_province_city.js 包含“省份”“市级”数据 10 KB
dist/jd_province_city_id.js 包含“省份”“市级”数据(含ID) 15 KB
dist/jd_province_city_area.js 包含“省份”“市级”“县级”数据 94 KB
dist/jd_province_city_area_id.js 包含“省份”“市级”“县级”数据(含ID) 149 KB

文件列表(国家统计局数据源)

文件名称 文件描述 文件大小
dist/gov_province_city.js 包含“省份”“市级”数据 11 KB
dist/gov_province_city_id.js 包含“省份”“市级”数据(含ID) 15 KB
dist/gov_province_city_area.js 包含“省份”“市级”“县级”数据 68 KB
dist/gov_province_city_area_id.js 包含“省份”“市级”“县级”数据(含ID) 112 KB

安装

$ npm install ydui-district --save

或: 

<script src="//unpkg.com/ydui-district/dist/gov_province_city_area_id.js"></script>
console.log(window.YDUI_DISTRICT);

使用

import District from 'ydui-district/dist/gov_province_city_area_id';

或: 

var District = require('ydui-district/dist/gov_province_city_area_id');

生成最新数据文件

1. npm install

2. npm run build:jd (生成京东数据源文件)

3. npm run build:gov (生成国家统计局数据源文件)

文件内容数据格式

  • 键值说明:v => value, n => name, c => children
  • 不含ID文件:即不包含【"v": "1"】
var district = [
    {
        "v": "1",
        "n": "北京",
        "c": [
            {
                "v": "2816",
                "n": "密云区",
                "c": [
                    {"v": "6667", "n": "城区"},
                    {"v": "2862", "n": "城区以外"},
                    ......
                ]
            },
            {
                "v": "72",
                "n": "朝阳区",
                "c": [
                    {"v": "2819", "n": "三环到四环之间"},
                    {"v": "2839", "n": "四环到五环之间"},
                    {"v": "2840", "n": "五环到六环之间"},
                    ......
                ]
            },
            ......
        ]
    },
    {
        "v": "2",
        "n": "上海",
        "c": [
            {
                "v": "2817",
                "n": "静安区",
                "c": [
                    {"v": "51973", "n": "城区"},
                    .....
                ]
            },
            {
                "v": "2820",
                "n": "闸北区",
                "c": [
                    {"v": "51972", "n": "城区"},
                    ......
                ]
            },
            ......
        ]
    },
    .....
];

if (typeof define === "function") {
    define(district)
} else {
    window.YDUI_DISTRICT = district
}

ydui-district's People

Contributors

ydcss avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.