diff --git a/.babelrc b/.babelrc new file mode 100644 index 000000000..d364d7a6f --- /dev/null +++ b/.babelrc @@ -0,0 +1,28 @@ +{ + "presets": [ + ["env", { + "modules": false, + "targets": { + "browsers": [ + "> 1%", + "last 2 versions", + "not ie <= 20", + "not ie_mob <= 100", + "not ff <= 100", + "not and_ff <= 100", + "not Edge <= 100", + "Android >= 4.0" + ] + } + }], + "stage-2" + ], + "plugins": ["transform-runtime", "add-module-exports", "transform-es2015-modules-umd"], + "comments": false, + "env": { + "test": { + "presets": ["env", "stage-2"], + "plugins": [ "istanbul" ] + } + } +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..9d08a1a82 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..34af3774f --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +build/*.js +config/*.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000..39d398645 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,24 @@ +module.exports = { + root: true, + parser: 'babel-eslint', + parserOptions: { + sourceType: 'module' + }, + // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style + extends: 'standard', + // required to lint *.vue files + plugins: [ + 'html' + ], + // add your custom rules here + 'rules': { + // allow paren-less arrow functions + 'arrow-parens': 0, + // allow async-await + 'generator-star-spacing': 0, + // allow debugger during development + 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, + 'no-tabs': 0, + 'space-before-function-paren': 0 + } +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..55e4beac3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.idea/ +.DS_Store +node_modules/ +npm-debug.log +deploy/ +test/unit/coverage +test/e2e/reports +selenium-debug.log +yarn.lock diff --git a/.npmrc b/.npmrc new file mode 100644 index 000000000..43c97e719 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..2ccb812d8 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,28 @@ +# Contribution Guideline + +Thanks for considering to contribute this project. All issues and pull requests are highly appreciated. + +## Pull Requests + +Before sending pull request to this project, please read and follow guidelines below. + +1. Branch: We only accept pull request on `dev` branch. +2. Coding style: Follow the coding style used in cube-ui. +3. Commit message: Use English and be aware of your spell. +4. Test: Make sure to test your code. + +Add device mode, API version, related log, screenshots and other related information in your pull request if possible. + +NOTE: We assume all your contribution can be licensed under the [Apache License 2.0](https://github.com/didi/cube-ui/blob/master/LICENSE). + +## Issues + +We love clearly described issues. :) + +Following information can help us to resolve the issue faster. + +* Device mode and hardware information. +* API version. +* Logs. +* Screenshots. +* Steps to reproduce the issue. diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..148493e08 --- /dev/null +++ b/LICENSE @@ -0,0 +1,433 @@ + Apache License + + Version 2.0, January 2004 + + http://www.apache.org/licenses/ + + + + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + + + +1. Definitions. + + + + + "License" shall mean the terms and conditions for use, reproduction, + + and distribution as defined by Sections 1 through 9 of this document. + + + + + "Licensor" shall mean the copyright owner or entity authorized by + + the copyright owner that is granting the License. + + + + + "Legal Entity" shall mean the union of the acting entity and all + + other entities that control, are controlled by, or are under common + + control with that entity. For the purposes of this definition, + + "control" means (i) the power, direct or indirect, to cause the + + direction or management of such entity, whether by contract or + + otherwise, or (ii) ownership of fifty percent (50%) or more of the + + outstanding shares, or (iii) beneficial ownership of such entity. + + + + + "You" (or "Your") shall mean an individual or Legal Entity + + exercising permissions granted by this License. + + + + + "Source" form shall mean the preferred form for making modifications, + + including but not limited to software source code, documentation + + source, and configuration files. + + + + + "Object" form shall mean any form resulting from mechanical + + transformation or translation of a Source form, including but + + not limited to compiled object code, generated documentation, + + and conversions to other media types. + + + + + "Work" shall mean the work of authorship, whether in Source or + + Object form, made available under the License, as indicated by a + + copyright notice that is included in or attached to the work + + (an example is provided in the Appendix below). + + + + + "Derivative Works" shall mean any work, whether in Source or Object + + form, that is based on (or derived from) the Work and for which the + + editorial revisions, annotations, elaborations, or other modifications + + represent, as a whole, an original work of authorship. For the purposes + + of this License, Derivative Works shall not include works that remain + + separable from, or merely link (or bind by name) to the interfaces of, + + the Work and Derivative Works thereof. + + + + + "Contribution" shall mean any work of authorship, including + + the original version of the Work and any modifications or additions + + to that Work or Derivative Works thereof, that is intentionally + + submitted to Licensor for inclusion in the Work by the copyright owner + + or by an individual or Legal Entity authorized to submit on behalf of + + the copyright owner. For the purposes of this definition, "submitted" + + means any form of electronic, verbal, or written communication sent + + to the Licensor or its representatives, including but not limited to + + communication on electronic mailing lists, source code control systems, + + and issue tracking systems that are managed by, or on behalf of, the + + Licensor for the purpose of discussing and improving the Work, but + + excluding communication that is conspicuously marked or otherwise + + designated in writing by the copyright owner as "Not a Contribution." + + + + + "Contributor" shall mean Licensor and any individual or Legal Entity + + on behalf of whom a Contribution has been received by Licensor and + + subsequently incorporated within the Work. + + + + +2. Grant of Copyright License. Subject to the terms and conditions of + + this License, each Contributor hereby grants to You a perpetual, + + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + + copyright license to reproduce, prepare Derivative Works of, + + publicly display, publicly perform, sublicense, and distribute the + + Work and such Derivative Works in Source or Object form. + + + + +3. Grant of Patent License. Subject to the terms and conditions of + + this License, each Contributor hereby grants to You a perpetual, + + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + + (except as stated in this section) patent license to make, have made, + + use, offer to sell, sell, import, and otherwise transfer the Work, + + where such license applies only to those patent claims licensable + + by such Contributor that are necessarily infringed by their + + Contribution(s) alone or by combination of their Contribution(s) + + with the Work to which such Contribution(s) was submitted. If You + + institute patent litigation against any entity (including a + + cross-claim or counterclaim in a lawsuit) alleging that the Work + + or a Contribution incorporated within the Work constitutes direct + + or contributory patent infringement, then any patent licenses + + granted to You under this License for that Work shall terminate + + as of the date such litigation is filed. + + + + +4. Redistribution. You may reproduce and distribute copies of the + + Work or Derivative Works thereof in any medium, with or without + + modifications, and in Source or Object form, provided that You + + meet the following conditions: + + + + + (a) You must give any other recipients of the Work or + + Derivative Works a copy of this License; and + + + + + (b) You must cause any modified files to carry prominent notices + + stating that You changed the files; and + + + + + (c) You must retain, in the Source form of any Derivative Works + + that You distribute, all copyright, patent, trademark, and + + attribution notices from the Source form of the Work, + + excluding those notices that do not pertain to any part of + + the Derivative Works; and + + + + + (d) If the Work includes a "NOTICE" text file as part of its + + distribution, then any Derivative Works that You distribute must + + include a readable copy of the attribution notices contained + + within such NOTICE file, excluding those notices that do not + + pertain to any part of the Derivative Works, in at least one + + of the following places: within a NOTICE text file distributed + + as part of the Derivative Works; within the Source form or + + documentation, if provided along with the Derivative Works; or, + + within a display generated by the Derivative Works, if and + + wherever such third-party notices normally appear. The contents + + of the NOTICE file are for informational purposes only and + + do not modify the License. You may add Your own attribution + + notices within Derivative Works that You distribute, alongside + + or as an addendum to the NOTICE text from the Work, provided + + that such additional attribution notices cannot be construed + + as modifying the License. + + + + + You may add Your own copyright statement to Your modifications and + + may provide additional or different license terms and conditions + + for use, reproduction, or distribution of Your modifications, or + + for any such Derivative Works as a whole, provided Your use, + + reproduction, and distribution of the Work otherwise complies with + + the conditions stated in this License. + + + + +5. Submission of Contributions. Unless You explicitly state otherwise, + + any Contribution intentionally submitted for inclusion in the Work + + by You to the Licensor shall be under the terms and conditions of + + this License, without any additional terms or conditions. + + Notwithstanding the above, nothing herein shall supersede or modify + + the terms of any separate license agreement you may have executed + + with Licensor regarding such Contributions. + + + + +6. Trademarks. This License does not grant permission to use the trade + + names, trademarks, service marks, or product names of the Licensor, + + except as required for reasonable and customary use in describing the + + origin of the Work and reproducing the content of the NOTICE file. + + + + +7. Disclaimer of Warranty. Unless required by applicable law or + + agreed to in writing, Licensor provides the Work (and each + + Contributor provides its Contributions) on an "AS IS" BASIS, + + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + + implied, including, without limitation, any warranties or conditions + + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + + PARTICULAR PURPOSE. You are solely responsible for determining the + + appropriateness of using or redistributing the Work and assume any + + risks associated with Your exercise of permissions under this License. + + + + +8. Limitation of Liability. In no event and under no legal theory, + + whether in tort (including negligence), contract, or otherwise, + + unless required by applicable law (such as deliberate and grossly + + negligent acts) or agreed to in writing, shall any Contributor be + + liable to You for damages, including any direct, indirect, special, + + incidental, or consequential damages of any character arising as a + + result of this License or out of the use or inability to use the + + Work (including but not limited to damages for loss of goodwill, + + work stoppage, computer failure or malfunction, or any and all + + other commercial damages or losses), even if such Contributor + + has been advised of the possibility of such damages. + + + + +9. Accepting Warranty or Additional Liability. While redistributing + + the Work or Derivative Works thereof, You may choose to offer, + + and charge a fee for, acceptance of support, warranty, indemnity, + + or other liability obligations and/or rights consistent with this + + License. However, in accepting such obligations, You may act only + + on Your own behalf and on Your sole responsibility, not on behalf + + of any other Contributor, and only if You agree to indemnify, + + defend, and hold each Contributor harmless for any liability + + incurred by, or claims asserted against, such Contributor by reason + + of your accepting any such warranty or additional liability. + + + + +END OF TERMS AND CONDITIONS + + + + +APPENDIX: How to apply the Apache License to your work. + + + + + To apply the Apache License to your work, attach the following + + boilerplate notice, with the fields enclosed by brackets "{}" + + replaced with your own identifying information. (Don't include + + the brackets!) The text should be enclosed in the appropriate + + comment syntax for the file format. We also recommend that a + + file or class name and description of purpose be included on the + + same "printed page" as the copyright notice for easier + + identification within third-party archives. + + + + +Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd. All rights reserved. + + + + +Licensed under the Apache License, Version 2.0 (the "License"); + +you may not use this file except in compliance with the License. + +You may obtain a copy of the License at + + + + + http://www.apache.org/licenses/LICENSE-2.0 + + + + +Unless required by applicable law or agreed to in writing, software + +distributed under the License is distributed on an "AS IS" BASIS, + +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + +See the License for the specific language governing permissions and + +limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 000000000..cb0619458 --- /dev/null +++ b/README.md @@ -0,0 +1,57 @@ +# cube-ui + +> A fantastic mobile ui lib implement by Vue. + +### Links + +- [Home](https://didi.github.io/cube-ui/) +- [Docs](https://didi.github.io/cube-ui/#/en-US/docs) +- [Example](https://didi.github.io/cube-ui/example/) + +![example QR](./assets/example-qr.png) + +### Install + +```shell +npm install cube-ui --save +``` + +### Usage + +```js +import Vue from 'vue' +import Cube from 'cube-ui' + +Vue.use(Cube) +``` + +#### Use modularized cube-ui + +```js +import Vue from 'vue' +import { Button, ActionSheet } from 'cube-ui' + +Vue.use(Button) +Vue.use(ActionSheet) +``` + +For more information, please refer to [Quick Start](https://didi.github.io/cube-ui/#/en-US/docs/quick-start) + +### ToDo + +- More components + +- Support theme + +### Development + +```shell +git clone git@github.com:didi/cube-ui.git +cd cube-ui +npm install +npm run dev +``` + +### Changelog + +Detailed changes for each release are documented in the [release notes](https://github.com/didi/cube-ui/releases). diff --git a/README_zh-CN.md b/README_zh-CN.md new file mode 100644 index 000000000..ad298472f --- /dev/null +++ b/README_zh-CN.md @@ -0,0 +1,57 @@ +# cube-ui + +> A fantastic mobile ui lib implement by Vue. + +### 导航 + +- [首页](https://didi.github.io/cube-ui/) +- [文档](https://didi.github.io/cube-ui/#/zh-CN/docs) +- [示例](https://didi.github.io/cube-ui/example/) + +![示例二维码](./assets/example-qr.png) + +### 安装 + +```shell +npm install cube-ui --save +``` + +### 使用 + +```js +import Vue from 'vue' +import Cube from 'cube-ui' + +Vue.use(Cube) +``` + +#### 按需使用 + +```js +import Vue from 'vue' +import { Button, ActionSheet } from 'cube-ui' + +Vue.use(Button) +Vue.use(ActionSheet) +``` + +注:上述使用依赖插件 [babel-plugin-transform-modules](https://www.npmjs.com/package/babel-plugin-transform-modules),详细内容请看 [开始文档](https://didi.github.io/cube-ui/#/zh-CN/docs/quick-start) + +### ToDo + +- 更多组件 + +- 主题支持 + +### Development + +```shell +git clone git@github.com:didi/cube-ui.git +cd cube-ui +npm install +npm run dev +``` + +### Changelog + +详细日志请看[发布日志](https://github.com/didi/cube-ui/releases)。 diff --git a/assets/example-qr.png b/assets/example-qr.png new file mode 100644 index 000000000..f5d179857 Binary files /dev/null and b/assets/example-qr.png differ diff --git a/assets/icon.png b/assets/icon.png new file mode 100644 index 000000000..98693c6e6 Binary files /dev/null and b/assets/icon.png differ diff --git a/build/build.js b/build/build.js new file mode 100644 index 000000000..f67dbbc2b --- /dev/null +++ b/build/build.js @@ -0,0 +1,73 @@ +// https://github.com/shelljs/shelljs +require('shelljs/global') +var config = require('../config') +if (!process.env.NODE_ENV) { + process.env.NODE_ENV = JSON.parse(config.build.env.NODE_ENV) +} + +var path = require('path') +var utils = require('./utils') +var ora = require('ora') +var webpack = require('webpack') +var webpackConfig = require('./webpack.prod.conf') +var webpackModulesConfig = require('./webpack.modules.conf') +var ExtractTextPlugin = require('extract-text-webpack-plugin') +var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') + +var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory) +rm('-rf', assetsPath) +mkdir('-p', assetsPath) +// cp('-R', 'static/*', assetsPath) + +function buildPack(webpackConfig, cb, spinnerText) { + var spinner = ora(spinnerText || 'building for uncompressed files...') + spinner.start() + webpack(webpackConfig, function (err, stats) { + spinner.stop() + if (err) { + throw err + } + process.stdout.write(stats.toString({ + colors: true, + modules: false, + children: false, + chunks: false, + chunkModules: false + }) + '\n') + cb && cb() + }) +} + +buildPack(webpackConfig, function () { + webpackConfig.output.filename = utils.assetsPath('[name].min.js') + webpackConfig.output.chunkFilename = '[name].min.js' + webpackConfig.plugins.splice(2, 1, new ExtractTextPlugin(utils.assetsPath('[name].min.css')), new OptimizeCSSPlugin({ + cssProcessorOptions: { + safe: true + } + })) + // add UglifyJsPlugin + webpackConfig.plugins.splice(2, 0, new webpack.optimize.UglifyJsPlugin({ + compress: { + warnings: false + } + })) + buildPack(webpackConfig, function () { + buildPack(webpackModulesConfig, function () { + webpackModulesConfig.output.filename = utils.assetsPath('[name]/[name].min.js') + webpackModulesConfig.output.chunkFilename = '[name]/[name].min.js' + webpackModulesConfig.plugins.splice(2, 1, new ExtractTextPlugin(utils.assetsPath('[name]/[name].min.css')), new OptimizeCSSPlugin({ + cssProcessorOptions: { + safe: true + } + })) + // 增加 UglifyJsPlugin + webpackModulesConfig.plugins.splice(2, 0, new webpack.optimize.UglifyJsPlugin({ + compress: { + warnings: false + } + })) + buildPack(webpackModulesConfig, null, 'building for compressed component files...') + }, 'building for uncompressed component files...') + }, 'building for compressed files...') +}) diff --git a/build/check-versions.js b/build/check-versions.js new file mode 100644 index 000000000..afa8c6f16 --- /dev/null +++ b/build/check-versions.js @@ -0,0 +1,49 @@ +var chalk = require('chalk') +var semver = require('semver') +var packageConfig = require('../package.json') +var shell = require('shelljs') +function exec (cmd) { + return require('child_process').execSync(cmd).toString().trim() +} + +var versionRequirements = [ + { + name: 'node', + currentVersion: semver.clean(process.version), + versionRequirement: packageConfig.engines.node + }, +] + +if (shell.which('npm')) { + versionRequirements.push({ + name: 'npm', + currentVersion: exec('npm --version'), + versionRequirement: packageConfig.engines.npm + }) +} + +module.exports = function () { + var warnings = [] + var i + for (i = 0; i < versionRequirements.length; i++) { + var mod = versionRequirements[i] + if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { + warnings.push(mod.name + ': ' + + chalk.red(mod.currentVersion) + ' should be ' + + chalk.green(mod.versionRequirement) + ) + } + } + + if (warnings.length) { + console.log('') + console.log(chalk.yellow('To use this template, you must update following to modules:')) + console.log() + for (i = 0; i < warnings.length; i++) { + var warning = warnings[i] + console.log(' ' + warning) + } + console.log() + process.exit(1) + } +} diff --git a/build/dev-client.js b/build/dev-client.js new file mode 100644 index 000000000..20e8cd692 --- /dev/null +++ b/build/dev-client.js @@ -0,0 +1,10 @@ +/* eslint-disable */ +require('eventsource-polyfill') +var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') + +hotClient.subscribe(function (event) { + if (event.action === 'reload') { + window.location.reload() + } +}) + diff --git a/build/dev-server.js b/build/dev-server.js new file mode 100644 index 000000000..73a5b792d --- /dev/null +++ b/build/dev-server.js @@ -0,0 +1,101 @@ +require('./check-versions')() + +var config = require('../config') +if (!process.env.NODE_ENV) { + process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV) +} + +var path = require('path') +var express = require('express') +var webpack = require('webpack') +var opn = require('opn') +var proxyMiddleware = require('http-proxy-middleware') +var webpackConfig = require('./webpack.dev.conf') + +// default port where dev server listens for incoming traffic +var port = process.env.PORT || config.dev.port +// Define HTTP proxies to your custom API backend +// https://github.com/chimurai/http-proxy-middleware +var proxyTable = config.dev.proxyTable +// automatically open browser, if not set will be false +var autoOpenBrowser = !!config.dev.autoOpenBrowser + +var app = express() +var compiler = webpack(webpackConfig) + +// var devMiddleware = require('webpack-dev-middleware')(compiler, { +// publicPath: webpackConfig.output.publicPath, +// stats: { +// colors: true, +// chunks: false +// }, +// watchOptions: { +// aggregateTimeout: 300, +// poll: 1000 +// } +// }) +var devMiddleware = require('webpack-dev-middleware')(compiler, { + publicPath: webpackConfig.output.publicPath, + quiet: true +}) + +var hotMiddleware = require('webpack-hot-middleware')(compiler, { + log: function () {} +}) +// force page reload when html-webpack-plugin template changes +compiler.plugin('compilation', function (compilation) { + compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) { + hotMiddleware.publish({action: 'reload'}) + cb() + }) +}) + +// proxy api requests +Object.keys(proxyTable).forEach(function (context) { + var options = proxyTable[context] + if (typeof options === 'string') { + options = {target: options} + } + app.use(proxyMiddleware(context, options)) +}) + +// handle fallback for HTML5 history API +app.use(require('connect-history-api-fallback')()) + +// serve webpack bundle output +app.use(devMiddleware) + +// enable hot-reload and state-preserving +// compilation error display +app.use(hotMiddleware) + +// serve pure static assets +var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory) +app.use(staticPath, express.static('./static')) + +var uri = 'http://localhost:' + port + +var _resolve +var readyPromise = new Promise(resolve => { + _resolve = resolve +}) + +console.log('> Starting dev server...') +devMiddleware.waitUntilValid(() => { + console.log('> Listening at ' + uri + '\n') + // when env is testing, don't need open it + if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') { + opn(uri) + } + _resolve() +}) + +var server = app.listen(port) + +module.exports = { + ready: readyPromise, + close: () => { + server.close() + } +} + diff --git a/build/document/build.js b/build/document/build.js new file mode 100644 index 000000000..fc6c42bc3 --- /dev/null +++ b/build/document/build.js @@ -0,0 +1,34 @@ +require('shelljs/global') +process.env.NODE_ENV = 'production' + +var ora = require('ora') +var rm = require('rimraf') +var path = require('path') +var chalk = require('chalk') +var webpack = require('webpack') +var config = require('../../config') +var webpackConfig = require('./webpack.prod.conf') + +var spinner = ora('building for document production...') +spinner.start() + +rm(path.join(config.docBuild.assetsRoot, config.docBuild.assetsSubDirectory), err => { + if (err) { + throw err + } + webpack(webpackConfig, function (err, stats) { + spinner.stop() + if (err) { + throw err + } + process.stdout.write(stats.toString({ + colors: true, + modules: false, + children: false, + chunks: false, + chunkModules: false + }) + '\n\n') + + console.log(chalk.cyan(' Document build complete.\n')) + }) +}) diff --git a/build/document/dev-server.js b/build/document/dev-server.js new file mode 100644 index 000000000..3bf3eec08 --- /dev/null +++ b/build/document/dev-server.js @@ -0,0 +1,70 @@ +var path = require('path') +var express = require('express') +var webpack = require('webpack') +var config = require('../../config') +var opn = require('opn') +var proxyMiddleware = require('http-proxy-middleware') +var webpackConfig = require('./webpack.dev.conf') + +// default port where dev server listens for incoming traffic +var port = process.env.PORT || config.docDev.port +// Define HTTP proxies to your custom API backend +// https://github.com/chimurai/http-proxy-middleware +var proxyTable = config.dev.proxyTable + +var app = express() +var compiler = webpack(webpackConfig) + +var devMiddleware = require('webpack-dev-middleware')(compiler, { + publicPath: webpackConfig.output.publicPath, + stats: { + colors: true, + chunks: false + }, + watchOptions: { + aggregateTimeout: 300, + poll: 1000 + } +}) + +var hotMiddleware = require('webpack-hot-middleware')(compiler) +// force page reload when html-webpack-plugin template changes +compiler.plugin('compilation', function (compilation) { + compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) { + hotMiddleware.publish({action: 'reload'}) + cb() + }) +}) + +// proxy api requests +Object.keys(proxyTable).forEach(function (context) { + var options = proxyTable[context] + if (typeof options === 'string') { + options = {target: options} + } + app.use(proxyMiddleware(context, options)) +}) + +// handle fallback for HTML5 history API +app.use(require('connect-history-api-fallback')()) + +// serve webpack bundle output +app.use(devMiddleware) + +// enable hot-reload and state-preserving +// compilation error display +app.use(hotMiddleware) + +// serve pure static assets +var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory) +app.use(staticPath, express.static('./static')) + +module.exports = app.listen(port, function (err) { + if (err) { + console.log(err) + return + } + var uri = 'http://localhost:' + port + console.log('Listening at ' + uri + '\n') + opn(uri) +}) diff --git a/build/document/webpack.dev.conf.js b/build/document/webpack.dev.conf.js new file mode 100644 index 000000000..49526ffb2 --- /dev/null +++ b/build/document/webpack.dev.conf.js @@ -0,0 +1,23 @@ +var config = require('../../config') +var devWebpackConfig = require('../webpack.dev.conf') +var HtmlWebpackPlugin = require('html-webpack-plugin') + +var entry = config.docDev.entry +// add hot-reload related code to entry chunks +Object.keys(entry).forEach(function (name) { + entry[name] = ['./build/dev-client'].concat(entry[name]) +}) + +var docDevWebpackConfig = Object.assign({}, devWebpackConfig) +var index = docDevWebpackConfig.plugins.findIndex(function (plugin) { + return plugin instanceof HtmlWebpackPlugin +}) +docDevWebpackConfig.plugins.splice(index, 1, new HtmlWebpackPlugin({ + filename: 'index.html', + template: config.docDev.template, + inject: true +})) + +docDevWebpackConfig.entry = entry + +module.exports = docDevWebpackConfig diff --git a/build/document/webpack.prod.conf.js b/build/document/webpack.prod.conf.js new file mode 100644 index 000000000..fa080f0b2 --- /dev/null +++ b/build/document/webpack.prod.conf.js @@ -0,0 +1,104 @@ +var path = require('path') +var config = require('../../config') +var utils = require('../utils') +var webpack = require('webpack') +var merge = require('webpack-merge') +var baseWebpackConfig = require('../webpack.base.conf') +var ExtractTextPlugin = require('extract-text-webpack-plugin') +var HtmlWebpackPlugin = require('html-webpack-plugin') +var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') + +var webpackConfig = merge(baseWebpackConfig, { + entry: { + app: './document/main.js' + }, + module: { + rules: utils.styleLoaders({ + sourceMap: config.docBuild.productionSourceMap, + extract: true + }) + }, + devtool: config.docBuild.productionSourceMap ? '#source-map' : false, + output: { + path: config.docBuild.assetsRoot, + publicPath: '/cube-ui/', + filename: utils.assetsPath('js/[name].[chunkhash].js'), + chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') + }, + plugins: [ + new webpack.DefinePlugin({ + 'process.env': config.docBuild.env + }), + new webpack.optimize.UglifyJsPlugin({ + compress: { + warnings: false + } + }), + // extract css into its own file + new ExtractTextPlugin(utils.assetsPath('css/[name].[contenthash].css')), + // Compress extracted CSS. We are using this plugin so that possible + // duplicated CSS from different components can be deduped. + new OptimizeCSSPlugin({ + cssProcessorOptions: { + safe: true + } + }), + // generate dist index.html with correct asset hash for caching. + // you can customize output by editing /index.html + // see https://github.com/ampedandwired/html-webpack-plugin + new HtmlWebpackPlugin({ + filename: config.docBuild.index, + template: 'document/index.html', + inject: true, + minify: { + removeComments: true, + collapseWhitespace: true, + removeAttributeQuotes: true + // more options: + // https://github.com/kangax/html-minifier#options-quick-reference + }, + // necessary to consistently work with multiple chunks via CommonsChunkPlugin + chunksSortMode: 'dependency' + }), + // split vendor js into its own file + new webpack.optimize.CommonsChunkPlugin({ + name: 'vendor', + minChunks: function (module) { + // any required modules inside node_modules are extracted to vendor + return ( + module.resource && + /\.js$/.test(module.resource) && + module.resource.indexOf( + path.join(__dirname, '../../node_modules') + ) === 0 + ) + } + }), + // extract webpack runtime and module manifest to its own file in order to + // prevent vendor hash from being updated whenever app bundle is updated + new webpack.optimize.CommonsChunkPlugin({ + name: 'manifest', + chunks: ['vendor'] + }) + ] +}) + +if (config.build.productionGzip) { + var CompressionWebpackPlugin = require('compression-webpack-plugin') + + webpackConfig.plugins.push( + new CompressionWebpackPlugin({ + asset: '[path].gz[query]', + algorithm: 'gzip', + test: new RegExp( + '\\.(' + + config.build.productionGzipExtensions.join('|') + + ')$' + ), + threshold: 10240, + minRatio: 0.8 + }) + ) +} + +module.exports = webpackConfig diff --git a/build/example/build.js b/build/example/build.js new file mode 100644 index 000000000..73734b88f --- /dev/null +++ b/build/example/build.js @@ -0,0 +1,34 @@ +require('shelljs/global') +process.env.NODE_ENV = 'production' + +var ora = require('ora') +var rm = require('rimraf') +var path = require('path') +var chalk = require('chalk') +var webpack = require('webpack') +var config = require('../../config') +var webpackConfig = require('./webpack.prod.conf') + +var spinner = ora('building for example production...') +spinner.start() + +rm(path.join(config.demoBuild.assetsRoot, config.demoBuild.assetsSubDirectory), err => { + if (err) { + throw err + } + webpack(webpackConfig, function (err, stats) { + spinner.stop() + if (err) { + throw err + } + process.stdout.write(stats.toString({ + colors: true, + modules: false, + children: false, + chunks: false, + chunkModules: false + }) + '\n\n') + + console.log(chalk.cyan(' Example build complete.\n')) + }) +}) diff --git a/build/example/webpack.prod.conf.js b/build/example/webpack.prod.conf.js new file mode 100644 index 000000000..6cccb4b9f --- /dev/null +++ b/build/example/webpack.prod.conf.js @@ -0,0 +1,33 @@ +var config = require('../../config') +var utils = require('../utils') +var docProdWebpackConfig = require('../document/webpack.prod.conf') +var HtmlWebpackPlugin = require('html-webpack-plugin') + +var webpackConfig = Object.assign({}, docProdWebpackConfig, { + entry: config.demoBuild.entry, + output: { + path: config.demoBuild.assetsRoot, + filename: utils.assetsPath('js/[name].[chunkhash].js'), + chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') + } +}) + +var index = webpackConfig.plugins.findIndex(function (plugin) { + return plugin instanceof HtmlWebpackPlugin +}) +webpackConfig.plugins.splice(index, 1, new HtmlWebpackPlugin({ + filename: 'index.html', + template: 'example/index.html', + inject: true, + minify: { + removeComments: true, + collapseWhitespace: true, + removeAttributeQuotes: true + // more options: + // https://github.com/kangax/html-minifier#options-quick-reference + }, + // necessary to consistently work with multiple chunks via CommonsChunkPlugin + chunksSortMode: 'dependency' +})) + +module.exports = webpackConfig diff --git a/build/release/docs.sh b/build/release/docs.sh new file mode 100644 index 000000000..4e9b02f97 --- /dev/null +++ b/build/release/docs.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# git pull +git pull origin master +# build +npm run doc-demo-build +# ADD commit +git add docs/ +git commit -m 'docs build' +git push origin master diff --git a/build/release/publish.sh b/build/release/publish.sh new file mode 100644 index 000000000..eca7bfff3 --- /dev/null +++ b/build/release/publish.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# git pull +git pull origin master +# build +npm run build +# ADD commit +git add -A +git commit -m 'publish build' +git push origin master +# replace src/ __VERSION__ +node ./build/release/replace-version.js +# publish +npm publish +# checkout src/index.js +git checkout src/index.js diff --git a/build/release/replace-version.js b/build/release/replace-version.js new file mode 100644 index 000000000..314cb2ab4 --- /dev/null +++ b/build/release/replace-version.js @@ -0,0 +1,11 @@ +var fs = require('fs') +var path = require('path') +var pkg = require('../../package.json') +var version = pkg.version + +var mainPath = path.resolve(__dirname, '../../src/index.js') +var content = fs.readFileSync(mainPath).toString() + +content = content.replace('__VERSION__', '\'' + version + '\'') + +fs.writeFileSync(mainPath, content) diff --git a/build/utils.js b/build/utils.js new file mode 100644 index 000000000..1554cf683 --- /dev/null +++ b/build/utils.js @@ -0,0 +1,82 @@ +var path = require('path') +var config = require('../config') +var ExtractTextPlugin = require('extract-text-webpack-plugin') +var postcssConfig = require('../postcss.config.js') + +exports.assetsPath = function (_path) { + var assetsSubDirectory = process.env.NODE_ENV === 'production' + ? config.build.assetsSubDirectory + : config.dev.assetsSubDirectory + return path.posix.join(assetsSubDirectory, _path) +} + +exports.cssLoaders = function (options) { + options = options || {} + + var cssLoader = { + loader: 'css-loader', + options: { + minimize: process.env.NODE_ENV === 'production', + sourceMap: options.sourceMap + } + } + var postcssLoader = { + loader: 'postcss-loader', + options: { + sourceMap: options.sourceMap, + plugins: () => postcssConfig.plugins + } + } + + // generate loader string to be used with extract text plugin + function generateLoaders(loader, loaderOptions) { + var loaders = [cssLoader, postcssLoader] + if (loader) { + loaders.push({ + loader: loader + '-loader', + options: Object.assign({}, loaderOptions, { + sourceMap: options.sourceMap + }) + }) + } + + // Extract CSS when that option is specified + // (which is the case during production build) + if (options.extract) { + return ExtractTextPlugin.extract({ + use: loaders, + fallback: 'vue-style-loader' + }) + } else { + return ['vue-style-loader'].concat(loaders) + } + } + + var stylusOptions = { + 'resolve url': true + } + // https://vue-loader.vuejs.org/en/configurations/extract-css.html + return { + css: generateLoaders(), + postcss: generateLoaders(), + less: generateLoaders('less'), + sass: generateLoaders('sass', {indentedSyntax: true}), + scss: generateLoaders('sass'), + stylus: generateLoaders('stylus', stylusOptions), + styl: generateLoaders('stylus', stylusOptions) + } +} + +// Generate loaders for standalone style files (outside of .vue) +exports.styleLoaders = function (options) { + var output = [] + var loaders = exports.cssLoaders(options) + for (var extension in loaders) { + var loader = loaders[extension] + output.push({ + test: new RegExp('\\.' + extension + '$'), + use: loader + }) + } + return output +} diff --git a/build/vue-loader.conf.js b/build/vue-loader.conf.js new file mode 100644 index 000000000..8a346d522 --- /dev/null +++ b/build/vue-loader.conf.js @@ -0,0 +1,18 @@ +var utils = require('./utils') +var config = require('../config') +var isProduction = process.env.NODE_ENV === 'production' + +module.exports = { + loaders: utils.cssLoaders({ + sourceMap: isProduction + ? config.build.productionSourceMap + : config.dev.cssSourceMap, + extract: isProduction + }), + transformToRequire: { + video: 'src', + source: 'src', + img: 'src', + image: 'xlink:href' + } +} diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js new file mode 100644 index 000000000..ddd51452f --- /dev/null +++ b/build/webpack.base.conf.js @@ -0,0 +1,79 @@ +var path = require('path') +var config = require('../config') +var vueLoaderConfig = require('./vue-loader.conf') +var utils = require('./utils') +var webpack = require('webpack') +var version = require('../package.json').version + +function resolve (dir) { + return path.join(__dirname, '..', dir) +} + +const srcAndExampleAndTestAndDocument = [resolve('src'), resolve('example'), resolve('test'), resolve('document')] + +module.exports = { + output: { + path: config.build.assetsRoot, + publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath, + filename: '[name].js', + chunkFilename: '[name].js' + }, + resolve: { + extensions: ['.js', '.vue', '.json'], + alias: { + 'vue2': 'vue/dist/vue.esm.js', + '@': resolve('src') + } + }, + module: { + rules: [ + { + test: /\.(js|vue)$/, + loader: 'eslint-loader', + enforce: 'pre', + include: srcAndExampleAndTestAndDocument, + options: { + formatter: require('eslint-friendly-formatter') + } + }, + { + test: /\.vue$/, + loader: 'vue-loader', + options: vueLoaderConfig + }, + { + test: /\.js$/, + loader: 'babel-loader', + include: srcAndExampleAndTestAndDocument + }, + { + test: /\.(png|jpe?g|gif)(\?.*)?$/, + loader: 'url-loader', + include: srcAndExampleAndTestAndDocument, + options: { + limit: 10000, + name: utils.assetsPath('img/[name].[hash:7].[ext]') + } + }, + { + test: /\.(woff2?|eot|ttf|otf|svg)(\?.*)?$/, + loader: 'url-loader', + include: srcAndExampleAndTestAndDocument, + options: { + limit: 10000, + name: utils.assetsPath('fonts/[name].[hash:7].[ext]') + } + }, + { + test: /\.md$/, + include: resolve('document'), + loader: 'vue-markdown-loader' + } + ] + }, + plugins: [ + new webpack.DefinePlugin({ + __VERSION__: JSON.stringify(version) + }) + ] +} diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js new file mode 100644 index 000000000..1424544a8 --- /dev/null +++ b/build/webpack.dev.conf.js @@ -0,0 +1,39 @@ +var config = require('../config') +var webpack = require('webpack') +var merge = require('webpack-merge') +var utils = require('./utils') +var baseWebpackConfig = require('./webpack.base.conf') +var HtmlWebpackPlugin = require('html-webpack-plugin') +var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') + +var entry = { + app: './example/main.js' +} +// add hot-reload related code to entry chunks +Object.keys(entry).forEach(function (name) { + entry[name] = ['./build/dev-client'].concat(entry[name]) +}) + +module.exports = merge(baseWebpackConfig, { + entry: entry, + module: { + rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap }) + }, + // eval-source-map is faster for development + devtool: '#cheap-module-eval-source-map', + plugins: [ + new webpack.DefinePlugin({ + 'process.env': config.dev.env + }), + // https://github.com/glenjamin/webpack-hot-middleware#installation--usage + new webpack.HotModuleReplacementPlugin(), + new webpack.NoEmitOnErrorsPlugin(), + // https://github.com/ampedandwired/html-webpack-plugin + new HtmlWebpackPlugin({ + filename: 'index.html', + template: './example/index.html', + inject: true + }), + new FriendlyErrorsPlugin() + ] +}) diff --git a/build/webpack.modules.conf.js b/build/webpack.modules.conf.js new file mode 100644 index 000000000..fc50cdebc --- /dev/null +++ b/build/webpack.modules.conf.js @@ -0,0 +1,48 @@ +var path = require('path') +var fs = require('fs') +var config = require('../config') +var utils = require('./utils') +var webpack = require('webpack') +var merge = require('webpack-merge') +var baseWebpackConfig = require('./webpack.base.conf') +var ExtractTextPlugin = require('extract-text-webpack-plugin') +var HtmlWebpackPlugin = require('html-webpack-plugin') +var env = process.env.NODE_ENV === 'testing' + ? require('../config/test.env') + : config.build.env + +var modules = {} +var cPath = path.join(__dirname, '../src/modules') +var files = fs.readdirSync(cPath) +if (files) { + files.forEach(function (name) { + var p = path.join(cPath, name) + if (fs.statSync(p).isDirectory()) { + modules[name] = p + } + }) +} + +var webpackConfig = merge(baseWebpackConfig, { + entry: modules, + module: { + rules: utils.styleLoaders({ sourceMap: config.build.productionSourceMap, extract: true }) + }, + devtool: config.build.productionSourceMap ? '#source-map' : false, + output: { + path: config.build.assetsRoot, + filename: utils.assetsPath('[name]/index.js'), + library: 'cube', + libraryTarget: 'commonjs2' + }, + plugins: [ + // http://vuejs.github.io/vue-loader/workflow/production.html + new webpack.DefinePlugin({ + 'process.env': env + }), + // extract css into its own file + new ExtractTextPlugin(utils.assetsPath('[name]/style.css')) + ] +}) + +module.exports = webpackConfig diff --git a/build/webpack.prod.conf.js b/build/webpack.prod.conf.js new file mode 100644 index 000000000..2821537af --- /dev/null +++ b/build/webpack.prod.conf.js @@ -0,0 +1,47 @@ +var path = require('path') +var config = require('../config') +var utils = require('./utils') +var webpack = require('webpack') +var merge = require('webpack-merge') +var baseWebpackConfig = require('./webpack.base.conf') +var ExtractTextPlugin = require('extract-text-webpack-plugin') +var HtmlWebpackPlugin = require('html-webpack-plugin') +var CopyWebpackPlugin = require('copy-webpack-plugin') +var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') +var env = process.env.NODE_ENV === 'testing' + ? require('../config/test.env') + : config.build.env + +var webpackConfig = merge(baseWebpackConfig, { + entry: { + cube: './src/index.js' + }, + module: { + rules: utils.styleLoaders({ + sourceMap: config.build.productionSourceMap, + extract: true + }) + }, + devtool: config.build.productionSourceMap ? '#source-map' : false, + output: { + path: config.build.assetsRoot, + filename: utils.assetsPath('index.js'), + library: 'cube', + libraryTarget: 'umd' + }, + plugins: [ + // http://vuejs.github.io/vue-loader/workflow/production.html + new webpack.DefinePlugin({ + 'process.env': env + }), + // extract css into its own file + new ExtractTextPlugin(utils.assetsPath('style.css')) + ] +}) + +if (config.build.bundleAnalyzerReport) { + var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin + webpackConfig.plugins.push(new BundleAnalyzerPlugin()) +} + +module.exports = webpackConfig diff --git a/build/webpack.test.conf.js b/build/webpack.test.conf.js new file mode 100644 index 000000000..8aa60af81 --- /dev/null +++ b/build/webpack.test.conf.js @@ -0,0 +1,23 @@ +// This is the webpack config used for unit tests. + +var utils = require('./utils') +var webpack = require('webpack') +var merge = require('webpack-merge') +var baseConfig = require('./webpack.base.conf') + +var webpackConfig = merge(baseConfig, { + // use inline sourcemap for karma-sourcemap-loader + module: { + rules: utils.styleLoaders({ + sourceMap: true + }) + }, + devtool: '#inline-source-map', + plugins: [ + new webpack.DefinePlugin({ + 'process.env': require('../config/test.env') + }) + ] +}) + +module.exports = webpackConfig diff --git a/config/dev.env.js b/config/dev.env.js new file mode 100644 index 000000000..efead7c84 --- /dev/null +++ b/config/dev.env.js @@ -0,0 +1,6 @@ +var merge = require('webpack-merge') +var prodEnv = require('./prod.env') + +module.exports = merge(prodEnv, { + NODE_ENV: '"development"' +}) diff --git a/config/index.js b/config/index.js new file mode 100644 index 000000000..1543b1eeb --- /dev/null +++ b/config/index.js @@ -0,0 +1,56 @@ +// see http://vuejs-templates.github.io/webpack for documentation. +var path = require('path') + +module.exports = { + build: { + env: require('./prod.env'), + assetsRoot: path.resolve(__dirname, '../lib'), + assetsSubDirectory: '', + assetsPublicPath: './', + productionSourceMap: false, + // Gzip off by default as many popular static hosts such as + // Surge or Netlify already gzip all static assets for you. + // Before setting to `true`, make sure to: + // npm install --save-dev compression-webpack-plugin + productionGzip: false, + productionGzipExtensions: ['js', 'css'], + // Set to `true` or `false` to always turn it on or off + bundleAnalyzerReport: process.env.npm_config_report + }, + dev: { + env: require('./dev.env'), + port: 8081, + autoOpenBrowser: true, + assetsSubDirectory: '', + assetsPublicPath: '/', + proxyTable: {}, + // CSS Sourcemaps off by default because relative paths are "buggy" + // with this option, according to the CSS-Loader README + // (https://github.com/webpack/css-loader#sourcemaps) + // In our experience, they generally work as expected, + // just be aware of this issue when enabling this option. + cssSourceMap: false + }, + docBuild: { + env: require('./prod.env'), + index: path.resolve(__dirname, '../docs/index.html'), + assetsRoot: path.resolve(__dirname, '../docs'), + assetsSubDirectory: '', + productionSourceMap: false + }, + docDev: { + env: require('./dev.env'), + entry: { + document: './document/main.js' + }, + template: './document/index.html', + port: 8082, + }, + demoBuild: { + entry: { + app: './example/main.js' + }, + assetsRoot: path.resolve(__dirname, '../docs/example'), + assetsSubDirectory: '' + } +} diff --git a/config/prod.env.js b/config/prod.env.js new file mode 100644 index 000000000..773d263d3 --- /dev/null +++ b/config/prod.env.js @@ -0,0 +1,3 @@ +module.exports = { + NODE_ENV: '"production"' +} diff --git a/config/test.env.js b/config/test.env.js new file mode 100644 index 000000000..89f90deb2 --- /dev/null +++ b/config/test.env.js @@ -0,0 +1,6 @@ +var merge = require('webpack-merge') +var devEnv = require('./dev.env') + +module.exports = merge(devEnv, { + NODE_ENV: '"testing"' +}) diff --git a/document/App.vue b/document/App.vue new file mode 100644 index 000000000..cd7059e9e --- /dev/null +++ b/document/App.vue @@ -0,0 +1,11 @@ + + + diff --git a/document/common/config/menu.json b/document/common/config/menu.json new file mode 100644 index 000000000..5ed24eec6 --- /dev/null +++ b/document/common/config/menu.json @@ -0,0 +1,106 @@ +{ + "en-US": { + "overview": { + "name": "Overview", + "subList": { + "introduction": "Introduction", + "quick-start": "QuickStart", + "post-compile": "PostCompile" + } + }, + "components": { + "name": "Components", + "subList": { + "basic": { + "name": "Basic", + "subList": { + "button": "Button", + "checkbox": "Checkbox", + "checkbox-group": "CheckboxGroup", + "loading": "Loading", + "tip": "Tip" + } + }, + "popup": { + "name": "Popup", + "subList": { + "popup": "Popup", + "toast": "Toast", + "picker": "Picker", + "time-picker": "TimePicker", + "dialog": "Dialog", + "action-sheet": "ActionSheet" + } + }, + "scroll": { + "name": "Scroll", + "subList": { + "scroll": "Scroll", + "slide": "Slide", + "index-list": "IndexList" + } + } + } + }, + "modules": { + "name": "Modules", + "subList": { + "style": "style", + "create-api": "create-api", + "better-scroll": "better-scroll" + } + } + }, + "zh-CN": { + "overview": { + "name": "概览", + "subList": { + "introduction": "介绍", + "quick-start": "快速上手", + "post-compile": "后编译" + } + }, + "components": { + "name": "组件", + "subList": { + "basic": { + "name": "基础", + "subList": { + "button": "Button", + "checkbox": "Checkbox", + "checkbox-group": "CheckboxGroup", + "loading": "Loading", + "tip": "Tip" + } + }, + "popup": { + "name": "弹出层", + "subList": { + "popup": "Popup", + "toast": "Toast", + "picker": "Picker", + "time-picker": "TimePicker", + "dialog": "Dialog", + "action-sheet": "ActionSheet" + } + }, + "scroll": { + "name": "滚动", + "subList": { + "scroll": "Scroll", + "slide": "Slide", + "index-list": "IndexList" + } + } + } + }, + "modules": { + "name": "模块", + "subList": { + "style": "style", + "create-api": "create-api", + "better-scroll": "better-scroll" + } + } + } +} diff --git a/document/common/js/directive.js b/document/common/js/directive.js new file mode 100644 index 000000000..cba662573 --- /dev/null +++ b/document/common/js/directive.js @@ -0,0 +1,9 @@ +import Vue from 'vue' +import hljs from './highlight' + +Vue.directive('highlight', (el) => { + let blocks = el.querySelectorAll('pre code') + blocks.forEach(block => { + hljs.highlightBlock(block) + }) +}) diff --git a/document/common/js/highlight.js b/document/common/js/highlight.js new file mode 100644 index 000000000..0570ab819 --- /dev/null +++ b/document/common/js/highlight.js @@ -0,0 +1,19 @@ +import hljs from 'highlight.js/lib/highlight' + +import shell from 'highlight.js/lib/languages/shell' +import css from 'highlight.js/lib/languages/css' +import markdown from 'highlight.js/lib/languages/markdown' +import js from 'highlight.js/lib/languages/javascript' +import json from 'highlight.js/lib/languages/json' +import stylus from 'highlight.js/lib/languages/stylus' +import xml from 'highlight.js/lib/languages/xml' + +hljs.registerLanguage('css', css) +hljs.registerLanguage('markdown', markdown) +hljs.registerLanguage('javascript', js) +hljs.registerLanguage('json', json) +hljs.registerLanguage('shell', shell) +hljs.registerLanguage('stylus', stylus) +hljs.registerLanguage('xml', xml) + +export default hljs diff --git a/document/common/js/utils.js b/document/common/js/utils.js new file mode 100644 index 000000000..38add8510 --- /dev/null +++ b/document/common/js/utils.js @@ -0,0 +1,32 @@ +import cookie from 'js-cookie' + +export function setItem(k, v) { + try { + window.localStorage.setItem(k, v) + } catch (e) { + cookie.set(k, v, { + expires: 365 + }) + } +} + +export function getItem(k) { + let v = window.localStorage.getItem(k) + if (!v) { + v = cookie.get(k) + } + return v || '' +} + +export function getCurrentLang() { + const itemKey = 'CUBE_LANGUAGE' + const hash = window.location.hash + const hashZhLang = hash ? hash.indexOf('/zh-') >= 0 ? 'zh-CN' : 'en-US' : '' + const lang = hashZhLang || getItem(itemKey) || window.navigator.language || 'en-US' + let defaultLang = 'en-US' + if (lang.indexOf('zh-') >= 0) { + defaultLang = 'zh-CN' + } + setItem(itemKey, defaultLang) + return defaultLang +} diff --git a/document/common/stylus/base.styl b/document/common/stylus/base.styl new file mode 100644 index 000000000..7eedfa9a9 --- /dev/null +++ b/document/common/stylus/base.styl @@ -0,0 +1,10 @@ +@import "~@/common/stylus/variable.styl" + +html, body + width: 100% + height: 100% + background: $color-background + font-family -apple-system,"Helvetica Neue",Helvetica,Arial,"PingFang SC","Hiragino Sans GB","WenQuanYi Micro Hei","Microsoft Yahei",sans-serif + -webkit-font-smoothing antialiased +input + outline: 0 diff --git a/document/common/stylus/index.styl b/document/common/stylus/index.styl new file mode 100644 index 000000000..c803279fc --- /dev/null +++ b/document/common/stylus/index.styl @@ -0,0 +1,3 @@ +@import '~@/common/stylus/reset.styl' +@import "./base.styl" +@import "./md.styl" diff --git a/document/common/stylus/md.styl b/document/common/stylus/md.styl new file mode 100644 index 000000000..dde2f00aa --- /dev/null +++ b/document/common/stylus/md.styl @@ -0,0 +1,62 @@ +@import "~@/common/stylus/variable.styl" + +.md-body + font-size: $fontsize-medium + line-height: 1.6 + color: $color-dark-grey + p + margin: 1.2em 0 + h2 + margin-top: 1.2em + margin-bottom: .8em + font-size: 1.5em + font-weight: 600 + h3 + margin: 1em 0 1em + font-size: 1.25em + font-weight: 600 + h4 + margin: 0.8em 0 0.8em + font-size: 1.1em + font-weight: 600 + blockquote + padding: 0 1em + color: $color-grey + border-left: .25em solid $color-light-grey-s + table + // margin 0.8em 1em 0.8em 1em + width: 100% + color: $color-blue + box-sizing: border-box + th, td + padding: 6px 13px + border: 1px solid rgb(223, 226, 229) + vertical-align: middle + text-align: left + th + font-weight: 600 + background-color: $color-row-line + ul, ol, li + line-height: 20px + li + list-style: inherit + margin: 1em 0 + ul + padding-left: 20px +pre + margin: .8em 0 + font-size: 12px +code + font-family: monaco + line-height: 1.4 + color: rgb(199, 37, 78) + background: rgb(249, 242, 244) + padding: 2px 4px + box-sizing: border-box + font-size: 0.93em +strong + margin: 1em 0 1em + font-weight: bold +a + text-decoration: none + color: rgb(0, 154, 97) diff --git a/document/components/display/display.vue b/document/components/display/display.vue new file mode 100644 index 000000000..9f9a3d033 --- /dev/null +++ b/document/components/display/display.vue @@ -0,0 +1,66 @@ + + + + + diff --git a/document/components/display/phone.png b/document/components/display/phone.png new file mode 100644 index 000000000..9c3a669a6 Binary files /dev/null and b/document/components/display/phone.png differ diff --git a/document/components/docs/en-US.vue b/document/components/docs/en-US.vue new file mode 100644 index 000000000..710aa76d8 --- /dev/null +++ b/document/components/docs/en-US.vue @@ -0,0 +1,16 @@ + + + + + diff --git a/document/components/docs/en-US/action-sheet.md b/document/components/docs/en-US/action-sheet.md new file mode 100644 index 000000000..632edd6a6 --- /dev/null +++ b/document/components/docs/en-US/action-sheet.md @@ -0,0 +1,166 @@ +## Action Sheet 操作列表 + +`action-sheet`可看做是`dialog`的延伸,二者都属于模态框,但是`action-sheet`提供了更多的功能按钮,提供给用户更多的操作选择。`action-sheet`组件提供了2中常见的操作列表类型。 + +### 单独引入 + +```javascript + import { ActionSheet } from 'cube-ui' + + export default { + components: { + CubeActionSheet: ActionSheet + } + } +``` + +### 调用方式 + +通过在`action-sheet`组件上添加`ref`属性,获得对于组件的引用,然后调用`action-sheet`组件向外暴露出来的`show`,`hide`方法来控制组件的显示或消失: + +```html + + + +``` + +### 示例 + +```html + + + +``` + +### Props参数配置 + +| 参数 | 说明 | 类型 | 默认值 | +| ------------- |:-------------:| ---| ---| +| data | 需要展示的数据 | Array | [ ] | +| active | 高亮的选项 | Number | -1 | +| title | 组件的标题 | String | - | +| pickerStyle | 样式类型是否为picker型 | Boolean | false | + +此外,在传入的`data`数组中,每一项为一个`object`,其中可配置的字段如下: + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| ------------- |:-------------:| -----:| ---| ---| +| content | 展示的文案内容 | String | 纯文本/html文本 | - | +| align | 展示的文案对齐的方式 | String | left/center/right | center | +| class | 展示文案添加的class属性,用来单独定义样式 | String | - | + +### Event事件 + +| 参数 | 说明 | 参数1 | 参数2 | +| ------------- |:-------------:| --- | --- | +| cancel | 点击取消按钮向父组件传递的事件,同时action-sheet消失 | - | - | +| select | 点击action-sheet某项后向父组件传递的事件,同时action-sheet消失 | 选中项 | 选中项的索引值 | + diff --git a/document/components/docs/en-US/better-scroll.md b/document/components/docs/en-US/better-scroll.md new file mode 100644 index 000000000..e69de29bb diff --git a/document/components/docs/en-US/button.md b/document/components/docs/en-US/button.md new file mode 100644 index 000000000..e46ddb294 --- /dev/null +++ b/document/components/docs/en-US/button.md @@ -0,0 +1,61 @@ +## Button + +`Button` provides various types, styles, states and icons. + +### Example + +- Button type + +The default type is `button`, and you can set that to `submit` in form. + +```html +Button +Submit Button +``` + +- Button state + +Default is normal, can be set to active or disabled state. + +```html +Active Button +Disabled Button +``` + +- Icon + +You can set the class of `icon`. + +```html +Button With Icon +``` + +- Style + +You can set attributes like `light`, `inline`, `outline`, and `primary` to change the button's style. + +```html +Light Button +Inline Button +Outline Button +Primary Button +``` + +### Props configuration + +| Attribute | Description | Type | Accepted Values | Default | +| - | - | - | - | - | +| type | Button type | String | button/submit | button | +| active | active state | Boolean | true/false | false | +| disabled | disabled state | Boolean | true/false | false | +| icon | Icon | String | the class of icon | - | +| light | light style | Boolean | true/false | false | +| inline | whether inline | Boolean | true/false | false | +| outline | outline style | Boolean | true/false | false | +| primary | primary style | Boolean | true/false | false | + +### Events + +| Event Name | Description | Parameters | +| - | - | - | +| click | triggers when the button is clicked. If in disabled state, then it won't trigger | e - event target | diff --git a/document/components/docs/en-US/checkbox-group.md b/document/components/docs/en-US/checkbox-group.md new file mode 100644 index 000000000..33cfdda5a --- /dev/null +++ b/document/components/docs/en-US/checkbox-group.md @@ -0,0 +1,54 @@ +## CheckboxGroup + +`CheckboxGroup` is a group of checkboxs, which is used to select a group of options. It has vertical and horizontal styles. + +### Example + +- Vertical order + +Default is vertical order style. + +```html + + + Checkbox 1 + + + Checkbox 2 + + + Disabled Checkbox + + + Disabled & Checked Checkbox + + +``` + + +The value of `checkList` is an array, which represents the set of the values of `label` in selected checkboxs. + +- Horizontal order + +You can set `horizontal` to change the style to horizontal order. + +```html + + 1 + 2 + 3 + 4 + +``` + +### Props configuration + +| Attribute | Description | Type | Accepted Values | Default | +| - | - | - | - | - | +| horizontal | whether in horizontal order | Boolean | true/false | false | + +### Events + +| Event Name | Description | Parameters | +| - | - | - | +| input | triggers when the selecting state in the group changes | the set of values of selected checkboxs, which type is Array | diff --git a/document/components/docs/en-US/checkbox.md b/document/components/docs/en-US/checkbox.md new file mode 100644 index 000000000..8ef5af369 --- /dev/null +++ b/document/components/docs/en-US/checkbox.md @@ -0,0 +1,60 @@ +## Checkbox + +`Checkbox` component. You can set the state, pass on special class and set the position of the checkbox's icon. + +### Example + +- Basic usage + +```html + + Checkbox + +``` + +If selected, the value of `checked` is `true`. + +- Disabled state + +```html + + Disabled Checkbox + +``` + +Set `disabled` to `true` to turn into the disabled state. + +- Position of the checkbox icon + +```html + + Position Checkbox + +``` + +If setting `position` to `'right'`, the position of the checkbox's icon is on the right. + +- Change the value of model + +```html + + Set label Checkbox + +``` + +If `label` is setted, and when the checkbox is selected, the value of `checked` is `'labelValue'`. When not selected, the value is `false`; Therefore, in circumstances of single checkbox, better not set `label`. + +### Props configuration + +| Attribute | Description | Type | Accepted Values | Default | +| - | - | - | - | - | +| disabled | whether disabled | Boolean | true/false | false | +| position | position | String | left/right | left | +| label | if selected, then map the value to v-model | Boolean/String | - | '' | + +### Events + +| Event Name | Description | Parameters | +| - | - | - | +| input | triggers when the selecting state changes | the value of label if setted or boolean value which represents whether selected | + diff --git a/document/components/docs/en-US/create-api.md b/document/components/docs/en-US/create-api.md new file mode 100644 index 000000000..06860ec09 --- /dev/null +++ b/document/components/docs/en-US/create-api.md @@ -0,0 +1,3 @@ +## create-api module + +This module exports a function called `createAPI` with which you can invoke the custom component which has been instantiated in the api form. \ No newline at end of file diff --git a/document/components/docs/en-US/dialog.md b/document/components/docs/en-US/dialog.md new file mode 100644 index 000000000..508d23a52 --- /dev/null +++ b/document/components/docs/en-US/dialog.md @@ -0,0 +1,121 @@ +## Dialog + +`Dialog`模态框组件,提供了多种样式及交互形式。 + +### 单独引入 + +```javascript + import { Dialog } from 'cube-ui' + + export default { + components: { + CubeDialog: Dialog + } + } +``` + +### 调用方式 + +通过在`dialog`组件上添加`ref`属性,获得对于组件的引用,然后调用`dialog`组件向外暴露出来的`show`,`hide`方法来控制组件的显示或消失: + +```html + + + +``` + + +### 示例:确认框 + +```html + + + +``` + +### Props参数配置 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| ------------- |:-------------:| -----:| ---| ---| +| type | dialog类型 | String | alert(只有1个按钮)/confirm(2个按钮) | alert | +| icon | icon | String | [参照icon列表](http://localhost:8083/#/icon) | - | +| title | 标题 | String | - | - | +| txt | 正文 | String | - | - | +| show-close | 是否显示关闭按钮 | Boolean | true/false | false | +| check | 是否带checkbox | Object | - | - | +| actions | 平级操作 | Array | - | [ ] | +| txts | 正文为列表形式 | Array | - | [ ] | +| link | 文字链接 | String | - | - | +| cancel-btn-content | 取消按钮文案 | String | - | - | +| confirm-btn-content | 确认按钮文案 | String | - | - | +| cancel-btn-href | 取消按钮跳转链接 | String | - | - | +| confirm-btn-href | 确认按钮跳转链接 | String | - | - | +| is-cancel-btn-active | 取消按钮是否高亮 | Boolean | true/false | false | +| is-confirm-btn-active | 确认按钮是否高亮 | Boolean | true/false | true | + +其中`check`可配置的属性有: + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| ------------- |:-------------:| -----| ---| ---| +| txt | checkbox提示的文案 | String | - | - | +| value | 是否被选中 | Boolean | true/false | false | + +`actions`可配置的属性有: + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| ------------- |:-------------:| -----| ---| ---| +| text | 显示的文案 | String | - | - | +| active | 是否高亮 | Boolean | true/false | false | +| href | a标签的href属性 | String | - | - | + + + + +### Event事件 + +| 事件名 | 说明 | 参数1 | 参数2 | +| ----- | ---- | ----| ---- | +| confirm | 点击确认按钮后触发 | e (event事件对象) | - | +| cancel | 点击取消按钮后触发 | e (event事件对象) | - | +| close | 点击关闭按钮后触发 | e (event事件对象) | - | +| link-click | 点击文字链接后触发 | e (event事件对象) | - | +| btn-click | 点击actions中配置的按钮后触发 | 被点击的action | e (event事件对象) | diff --git a/document/components/docs/en-US/index-list.md b/document/components/docs/en-US/index-list.md new file mode 100644 index 000000000..9b8cae6e3 --- /dev/null +++ b/document/components/docs/en-US/index-list.md @@ -0,0 +1,177 @@ +## IndexList组件 + +`IndexList`基于`better-scroll`进行封装。提供了城市列表索引的功能。 + +### 单独引入 + +```javascript + import { IndexList } from 'cube-ui' + + export default { + components: { + CubeListview: IndexList + } + } +``` + +### 示例 + +```html + + + +``` + +## API + +### Props参数配置 + +| 参数 | 说明 | 类型 | 默认值 | +| ------------- |:-------------:|---| ---| --- | +| title | 标题 | String | - | +| data | 需要展示的数据 | Array | [] | + +### Event事件 + +| 事件名 | 说明 | 参数 | +| ----- | ---- | ----| +| select | 选中index-list的某一项后触发 | 被选中的选项 | +| title-click | 点击title后触发(title必须设置后才有效) | title值 | diff --git a/document/components/docs/en-US/install.md b/document/components/docs/en-US/install.md new file mode 100644 index 000000000..517808bb9 --- /dev/null +++ b/document/components/docs/en-US/install.md @@ -0,0 +1,24 @@ +## 安装 + + +### NPM + +推荐使用 NPM 安装`cube-ui` + +```shell +$ npm install cube-ui +``` + + +### CDN + +也可通过 unpkg.com 获取资源,用标签引入 js 和 css 文件使用。 + +```html + + +``` + +### 版本日志 + +版本的更新日志见 [GitHub](https://github.com/didi/cube-ui/releases) diff --git a/document/components/docs/en-US/introduction.md b/document/components/docs/en-US/introduction.md new file mode 100644 index 000000000..5045ad7aa --- /dev/null +++ b/document/components/docs/en-US/introduction.md @@ -0,0 +1,111 @@ +## Introduction + +cube-ui is an elegant mobile component library based on Vue.js. + +### Features + +- Extracted from Didi interior component library and has been put to business test for more than one year +- Every component has full unit tests to provide assurance for continuous integration +- Pursue the perfection of the interactive experience, which makes cube-ui close to native components +- Support post-compile and importing on demand, lightweight and flexible + +### Components + +#### Basic + +- [Button](#/en-US/docs/button) +- [Checkbox](#/en-US/docs/checkbox) +- [CheckboxGroup](#/en-US/docs/checkbox-group) +- [Loading](#/en-US/docs/loading) +- [Tip](#/en-US/docs/tip) + +#### Layer + +- [Toast](#/en-US/docs/toast) +- [Picker](#/en-US/docs/picker) +- [TimePicker](#/en-US/docs/time-picker) +- [Dialog](#/en-US/docs/dialog) +- [ActionSheet](#/en-US/docs/action-sheet) + +All the layer components can be invoked by components and API, let's take `Toast` as an example: + +Component invoking: + +```html + + +``` + +API invoking: + +```html + + +``` +Both are pretty good but we recommend the latter, namely using `$createXxYy` API to invoke; By API invoking, the popup layer is attached to `body` element whose advantage is that it wouldn't be affected by outer styles. If using component invoking, it's fairly easy to be affected by outer styles like `transform`, `overflow`, etc. + +Pay attention that the name of the API is `$create` + `${component name}`. For example, the API of `ActionSheet` component is `$createActionSheet`. + +#### Scroll + +- [Scroll](#/en-US/docs/scroll) +- [Slide](#/en-US/docs/slide) +- [IndexList](#/en-US/docs/index-list) + +Scroll Components are all implemented based on [better-scroll](https://github.com/ustbhuangyi/better-scroll) and `Scroll` Component is the encapsulation of better-scroll. + +### Modules + +cube-ui has some special modules besides components. + +#### style +The style module. +If you are under the circumstance of importing components on demand, then it is recommended to import this module in entry file because it contains basic reset, basic common styles and built-in icons. + +For details, see [style module](#/en-US/docs/style). + +#### create-api + +Sometimes, developers may need to let their own encapsulated components support API invoking as well. At this time they can import create-api module or use the global interface `Cube.createAPI` to achieve the purpose. + + +For details, see [create-api module](#/en-US/docs/create-api)。 + +#### better-scroll + +[better-scroll](https://github.com/ustbhuangyi/better-scroll) is a library in `cube-ui`'s dependencies. To avoid duplicately importing, we expose the module. + +For more detailed use, please refer to [official documentation](https://ustbhuangyi.github.io/better-scroll/#/zh)。 diff --git a/document/components/docs/en-US/loading.md b/document/components/docs/en-US/loading.md new file mode 100644 index 000000000..d2ccf6b48 --- /dev/null +++ b/document/components/docs/en-US/loading.md @@ -0,0 +1,21 @@ +## Loading + +`Loading` provides loading animation which can has custom size. + +### Example + +- The size of icon + +Default is `24px` and can be configured by setting `size`. + +```html + + + +``` + +### Props configuration + +| Attribute | Description | Type | Default | +| - | - | - | - | +| size | the size of loading icon, unit px | Number | 24 | diff --git a/document/components/docs/en-US/picker.md b/document/components/docs/en-US/picker.md new file mode 100644 index 000000000..8a0015e2e --- /dev/null +++ b/document/components/docs/en-US/picker.md @@ -0,0 +1,186 @@ +## Picker组件 + +`Picker`组件支持多列选择器及数据联动。 + +### 单独引入 + +```javascript + import { Picker } from 'cube-ui' + + export default { + components: { + CubePicker: Picker + } + } +``` + +### 调用方式 + +通过在`picker`组件上添加`ref`属性,获得对于组件的引用,然后调用`picker`组件向外暴露出来的`show`,`hide`方法来控制组件的显示或消失,`show`能接受回调函数: + +```html + + + +``` + +此外,`picker`还暴露出了`setData`和`setSelectedIndex`2个方法,用以动态设置`picker`需要展示的内容,以及当前被选中的值。 + +```javascript + const data = [{ text: 'a', value: 1}, { text: 'b', value: 2}] + + this.$refs.picker.setData(data) + this.$refs.picker.setSelectedIndex([1]) +``` + +### 示例 + +#### demo1 + +```html + + + +``` + +#### demo2 + +```html + + + +``` + +### API + +#### Props参数配置 + +| 参数 | 说明 | 类型 | 默认值 | 示例 | +| ----- |----------| -----|---| --- | +| title | 标题 | String | '' | - | +| data | 传入picker数据,数组的长度决定了picker的列数 | Array | [] | - | +| cancelTxt | picker左侧按钮文案 | String | '取消' | - | +| confirmTxt | picker右侧按钮文案 | String | '确定' | - | +| select-index | 被选中的索引值,拉起picker后显示这个索引值对应的内容 | Array | [] | [1] | + +其中传入`picker`的`data`数组中,每一项可配置的属性有: + +| 参数 | 说明 | 类型 | 默认值 | 示例 | +| ------------- |-------------| -----| ---| ---| +| text | picker每一列展示的文案 | String/Number | - | - | +| value | picker每一列展示的每项文案对应的值 | String/Number/Boolean | - | - | + +#### Event事件 + +| 事件名 | 说明 | 参数1 | 参数2 | +| ----- | ---- | ----| --- | +| select | 点击确认按钮触发此事件 | selectedVal: 当前选中项每一列的值,Array类型 | selectedIndex: 当前选中项每一列的索引,Array类型 | +| change | 滚轴滚动后触发此事件 | selectedVal: 当前选中项每一列的值,Array类型 | selectedIndex: 当前选中项每一列的索引,Array类型 | +| value-change | 所确认的值变化时触发此事件 | selectedVal: 当前确认项每一列的值,Array类型 | selectedIndex: 当前确认项每一列的索引,Array类型 | +| cancel | 点击取消按钮触发此事件 | - | - | + +#### 组件向外暴露方法 + +| 方法名 | 说明 | 接受的参数1 | +| ----- | ---- | ---- | +| show | 拉起picker组件 | - | +| hide | 隐藏picker组件 | - | +| setData | 设置picker可选项 | picker每列可选项的文案和值,Array类型 | +| setSelectedIndex | 设置picker选中项 | picker每列选中的索引,Array类型 | diff --git a/document/components/docs/en-US/popup.md b/document/components/docs/en-US/popup.md new file mode 100644 index 000000000..6be3b1e2d --- /dev/null +++ b/document/components/docs/en-US/popup.md @@ -0,0 +1,137 @@ +## Popup + +The underlying popup component, mainly used to implement upper component encapsulation based on itself. It only provides basic functions: specifying the type, whether there's a background layer, showing content (HTML) and whether the component is in center position. + +All of the built-in popup type components are implemented based on this component, including [Toast](#/en-US/docs/toast)、[Picker](#/en-US/docs/picker)、[TimePicker](#/en-US/docs/time-picker)、[Dialog](#/en-US/docs/dialog)、[ActionSheet](#/en-US/docs/action-sheet). + +### Example + +- Basic usage + +```html + + My Popup Content 1 + + + Show Popup + +``` + +Specifying `type` will help control class according to the type. In the example above, `cube-my-popup` will be added to the classList of the root element. + +```js +export default { + methods: { + showPopup(refId) { + const component = this.$refs[refId] + component.show() + setTimeout(() => { + component.hide() + }, 1000) + } + } +} +``` + +The component is hidden by default and won't show up unless invoking the `show()` method of the instance of the component. And of course, invoking the `hide()` method of the instance of the component will hide itself. That's what `showPopup()` does in the example above (first show and hide in one second). + +- Without background layer +```html + + My Popup Content 2 + + + Show Popup - no mask + +``` + +Setting `mask` to `false` and the background layer is hidden. + +- Show the HTML content + +```html + + + Show Popup - with content + +``` + +You only need to pass the HTML fragment on to `content`. + +- Setting to bottom + +```html +My Popup Content 4 + + Show Popup - bottom + +``` + +Considering that in mobile secnes, popup is in center or bottom most of the time (covered in horizontal direction when setted to bottom). So if setting `center` to `false`, you'll set the component to bottom. + +- Upper layer encapsulation + +```html + + + +``` + +An upper layer encapsulated CubeExtendPopup component with some styles is implemented. It supports passing the content on, has default slot and can be hidden if clicking the content. You can use it in this way (need to be registers globally or partially): + +```html + + + Show Extend Popup + +``` + +### Props configuration + +| Attribute | Description | Type | Accepted Values | Default | +| - | - | - | - | - | +| type | the type of popup | String | - | '' | +| mask | whether to show background layer | Boolean | true/false | true | +| content | content, HTML string, valid when there's no slot | String | - | '' | +| center | whether to be in center in horizontal and vertical direction | Boolean | true/false | true | + +### Events + +| Event Name | Description | Parameters | +| - | - | - | +| mask-click | triggers when the background layer is clicked | click event target | diff --git a/document/components/docs/en-US/post-compile.md b/document/components/docs/en-US/post-compile.md new file mode 100644 index 000000000..07316198c --- /dev/null +++ b/document/components/docs/en-US/post-compile.md @@ -0,0 +1,16 @@ +## Post-compile + +Post-compile means the npm packages that the application depend on don't need to be compiled before distribution but compiled along with the application's compiling and packaging. + +> Notes: For more detailed content about post-compile, see [webpack 应用编译优化之路](https://github.com/DDFE/DDFE-blog/issues/23). + +### Background + +More and more applications are developed with webpack + babel, and commonly their package management is by npm. With the growing of the number of package dependencies which are also developed with ES2015+ and needs to be compiled before distribution, the final compiled code usually contains a lot of compiling code. Therefore, to eliminate the redundancy, we recommend post-compile. + +### Strengths and weaknesses +- Public dependencies can share use and only need one copy. The more important is that you only need to compile once. + +### Rules + +### The configuration and use of webpack diff --git a/document/components/docs/en-US/quick-start.md b/document/components/docs/en-US/quick-start.md new file mode 100644 index 000000000..611ebe10b --- /dev/null +++ b/document/components/docs/en-US/quick-start.md @@ -0,0 +1,113 @@ +## Quick start + +### Install + +```shell +$ npm install cube-ui --save +``` + +### Usage + +It is recommended to use [babel-plugin-transform-modules](https://www.npmjs.com/package/babel-plugin-transform-modules),which helps you import component modules and corresponding styles more elegantly. + +Before use, the plugin needs some configuration. Modify .babelrc: + +- webpack 1.x + ```json + { + "plugins": ["transform-modules", { + "cube-ui": { + "transform": "cube-ui/lib/${member}", + "kebabCase": true, + "style": true + } + }] + } + ``` +- webpack 2+ + ```json + { + "plugins": ["transform-modules", { + "cube-ui": { + "transform": "cube-ui/src/modules/${member}", + "kebabCase": true + } + }] + } + ``` + + > [why distinguishs the version of webpack?](#/en-US/docs/post-compile) + +If not using babel-plugin-transform-modules, you need to import corresponding style files by hand. + +#### Fully import + +Commonly in the entry file: + +```javascript +import Vue from 'vue' +import Cube from 'cube-ui' + +Vue.use(Cube) +``` + +#### Import on demand + +```javascript +import { Button } from 'cube-ui' +``` + +You can choose to register globally or partially: + +```js +// register globally +Vue.use(Button) + +// or register partially +// in certain somponents +{ + components: { + CubeButton: Button + } +} +``` +All the components that can be imported on demand are listed below: + +```js +import { + Button, + Checkbox, + Loading, + Tip, + Toast, + Picker, + TimePicker, + Dialog, + ActionSheet, + Scroll, + Slide, + IndexList +} from 'cube-ui' +``` + +#### Examples + +```html + + + +``` diff --git a/document/components/docs/en-US/scroll.md b/document/components/docs/en-US/scroll.md new file mode 100644 index 000000000..ac6b42b42 --- /dev/null +++ b/document/components/docs/en-US/scroll.md @@ -0,0 +1,232 @@ +## Scroll + +`Scroll` component, which is encapsulated based on `better-scroll`, provides high-quality native scrolling experience and has convenient configuration along tith events. + +### Example + +- Basic usage + +By setting `data` to an array, you can generate the list which can scrolls elegantly in the container. + +```html +
+ +
+``` + +- Scroll bar + +Default is without scroll bar. You can set it to fade-in-fade-out or always-show style. + +```html + + + + +``` +```javascript +export default { + data() { + return { + items: [1, 2, 3, 4, 5], + scrollbar: { + fade: false + } + } + } +} +``` + +- Pull down to refresh + +There is no pull-down-to-refresh function by default. Configuring `pull-down-refresh` can turn on the dispatching of the event `pulling-down` and the animation of pulling down. You can listen to `pulling-down` event to update data. + +```html + + + + +``` +```javascript +export default { + data() { + return { + items: [1, 2, 3, 4, 5], + pullDownRefresh: { + threshold: 90, + stop: 40, + txt: 'Refresh success' + } + } + }, + methods: { + onPullingDown() { + // simulate updating data + setTimeout(() => { + if (Math.random() > 0.5) { + // if new data + this.items.unshift('I am new data: ' + +new Date()) + } else { + // if no new data + this.$refs.scroll.forceUpdate() + } + }, 1000) + } + } +} +``` + +- Pulling up to load + +There is no pull-up-to-load function by default. Configuring `pull-up-load` can turn on the dispatching of the event `pulling-up` and the animation of pulling up. You can listen to `pulling-up` event to update data. + + +```html + + + + +``` +```javascript +export default { + data() { + return { + items: [1, 2, 3, 4, 5], + itemIndex: 5, + pullUpLoad: { + threshold: 0, + txt: { + more: 'Load more', + noMore: 'No more data' + } + } + } + }, + methods: { + onPullingUp() { + // simulate updating data + setTimeout(() => { + if (Math.random() > 0.5) { + // if new data + let newPage = [ + 'I am line ' + ++this.itemIndex, + 'I am line ' + ++this.itemIndex, + 'I am line ' + ++this.itemIndex, + 'I am line ' + ++this.itemIndex, + 'I am line ' + ++this.itemIndex + ] + + this.items = this.items.concat(newPage) + } else { + // if no new data + this.$refs.scroll.forceUpdate() + } + }, 1000) + } + } +} +``` + +- Customize the animation of pulling down refreshing and pulling up loading + +If you don't like the built-in slots of pulling down refreshing and pulling up loading, you can use [scoped slots](https://vuejs.org/v2/guide/components.html#Scoped-Slots) to customize animation. The example below uses scoped slots to customize animation of pulling down refreshing, while pulling up loading keeps default built-in animation. + +```html + + + +``` + +With the parameters that scoped slots provide, you can control the process of animation according to the change of the state. Detailed scope parameters and their meaning are shown below in 'Slots'. + + +### Props configuration + +| Attribute | Description | Type | Accepted Values | Default | +| ------------------ | ---------------------------------------- | -------------- | ------------------------ | ---------- | +| data | data used for list rendering | Array | - | [] | +| direction | scrolling direction | String | 'vertical', 'horizontal' | 'vertical' | +| scrollbar | configuration for scroll bar | Boolean/Object | - | false | +| pullDownRefresh | configuration for pulling down refreshing | Boolean/Object | - | false | +| pullUpLoad | configuration for pulling up loading | Boolean/Object | - | false | +| listenScroll | whether to dispatch scroll event | Boolean | true/false | false | +| probeType | the dispatching time of scroll event
1. non-real-time dispatching;
2. real-time dispatching during the scrolling;
3. real-time dispatching during the entire scrolling including inertial stage | Number | 1, 2, 3 | 0 | +| listenBeforeScroll | whether to dispatch before-scroll-start event | Boolean | true/false | false | + +- `scrollbar` sub configuration + +| Attribute | Description | Type | Accepted Values | Default | +| --------- | -------------------------------------- | ------- | --------------- | ------- | +| fade | whether to have fade-in-fade-out style | Boolean | true/false | false | + +- `pullDownRefresh` sub configuration + +| Attribute | Description | Type | Accepted Values | Default | +| --------- | ---------------------------------------- | ------ | --------------- | ----------------- | +| threshold | the threshold of distance that pulling down for refreshing | Number | - | 90 | +| stop | the position where rebounding stays | Number | - | 40 | +| txt | the text shown when refreshing successfully | String | - | 'Refresh success' | + +- `pullUpLoad` sub configuration + +| Attribute | Description | Type | Accepted Values | Default | +| --------- | ---------------------------------------- | ------ | --------------- | ---------------------------------------- | +| threshold | the threshold of distance that pulling up for loading | Number | - | 0 | +| txt | the text shown when pulling up loading | Object | - | { more: 'Load more', noMore: 'No more data' } | + +### Slot + +| Name | Description | Scope Parameters | +| -------- | ---------------------------------------- | ---------------------------------------- | +| pulldown | located above the list and shown when pulling down refreshing | pullDownRefresh: whether to turn on pulling-down-refreshing function
pullDownStyle: the style of showing and fading
beforePullDown: whether in pulling down operation
pulling: whether in the process of pulling in data
bubbleY: the distance of pulling down currently - 50 | +| pullup | located below the list and shown when pulling up loading | pullUpLoad: whether to turn on pulling-up-loading function
isPullUpLoad: whether the data is being loaded | + +### Events + +| Event Name | Description | Parameters | +| ------------------- | ---------------------------------------- | ---------------------------------------- | +| click | triggers when clicking the list item | item - the data of the list item | +| scroll | triggers according to the value of probeType, if listenScroll is true | Object {x, y} - real-time scrolling coordinates | +| before-scroll-start | triggers before scrolling start, if listenBeforeScroll | - | +| pulling-down | triggers when the distance of pulling down exceeds the threshold, if pullDownRefresh is true | - | +| pulling-up | triggers when the distance of pulling up exceeds the threshold, if pullUpLoad is true | - | diff --git a/document/components/docs/en-US/slide.md b/document/components/docs/en-US/slide.md new file mode 100644 index 000000000..e95bcbe29 --- /dev/null +++ b/document/components/docs/en-US/slide.md @@ -0,0 +1,105 @@ +## Slide + +`Slide` component, which is also encapsulated based on `better-scroll`, provides common functions of `slider` and `swipe`. + +### Example + +- Basic usage + + `cube-slide` element is the entire slide component while `cube-slide-item` element is the page of each slide and it's slot is the content of the page. + + ```html + + + + + + + + ``` + ```javascript + export default { + data() { + return { + items: [ + { + url: 'http://www.didichuxing.com/', + image: '//webapp.didistatic.com/static/webapp/shield/cube-ui-examples-slide01.png' + }, { + url: 'http://www.didichuxing.com/', + image: '//webapp.didistatic.com/static/webapp/shield/cube-ui-examples-slide02.png' + }, { + url: 'http://www.didichuxing.com/', + image: '//webapp.didistatic.com/static/webapp/shield/cube-ui-examples-slide03.png' + } + ] + } + }, + methods: { + changePage(current) { + console.log('The index of current slide is ' + current) + }, + clickHandle(item, index) { + console.log(item, index) + } + } + } + ``` + +- Loop play + + Loop play is turned on by default. You can cnfigure that with `loop` attribute. + + ```html + + + ``` + +- Automatic play + + Automatic play is turned on by default. You can cnfigure that with `auto-play` attribute. + + ```html + + + ``` + +- Interval of automatic play + + When automatic play is turned on, you can configure the interval with `interval` attribute. + + ```html + + ``` + +- Sliding threshold of switching pages + + You can configure the sliding threshold of switching pages with `threshold` attribute. It means that when the sliding distance exceeds the page's width * `threshold`, the page is switched. Default is 0.3. + + ```html + + ``` + +- Speed of switching pages + + Animation of switching costs 400 ms by default. You can cnfigure that with `speed` attribute. + + ```html + + ``` + +### Props configuration + +| Attribute | Description | Type | Accepted Values | Default | +| --------- | ------------------------------------ | ------- | --------------- | ------- | +| loop | whether to loop play | Boolean | true/false | true | +| autoPlay | whether to play automatically | Boolean | true/false | true | +| interval | interval of play | Number | - | 4000 | +| threshold | sliding threshold of switching pages | Number | (0, 1) | 0.3 | +| speed | speed of switching pages | Number | - | 400 | + +### 事件 + +| Event Name | Description | Parameters | +| ---------- | ----------------------------------- | ---------------------- | +| change | triggers when current slide changes | index of current slide | diff --git a/document/components/docs/en-US/style.md b/document/components/docs/en-US/style.md new file mode 100644 index 000000000..609464b9b --- /dev/null +++ b/document/components/docs/en-US/style.md @@ -0,0 +1,172 @@ +## style 模块 + +style 模块主要包含就是样式部分,包含基础的 reset、基础通用样式以及内置 icon。 + +### reset.css + +源码地址:[reset](https://github.com/didi/cube-ui/blob/master/src/common/stylus/reset.styl),使用的就是 Eric Meyer's Reset CSS。 + +```stylus +/** + * Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/) + * http://cssreset.com + */ +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, +menu, nav, output, ruby, section, summary, +time, mark, audio, video, input + margin: 0 + padding: 0 + border: 0 + font-size: 100% + font-weight: normal + vertical-align: baseline + +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, menu, nav, section + display: block + +body + line-height: 1 + +blockquote, q + quotes: none + +blockquote:before, blockquote:after, +q:before, q:after + content: none + +table + border-collapse: collapse + border-spacing: 0 + +/* custom */ + +a + color: #7e8c8d + -webkit-backface-visibility: hidden + text-decoration: none + +li + list-style: none + +body + -webkit-text-size-adjust: none + -webkit-tap-highlight-color: rgba(0, 0, 0, 0) +``` + +### base.css + +源码地址:[base](https://github.com/didi/cube-ui/blob/master/src/common/stylus/base.styl),主要包含的就是 `html`, `body` 元素的 `font-family`, `line-height` 等的设定,修正浮动影响的 `.clear-fix`,以及上下左右四个边框的绝对 1px 边框的 class:`.border-top-1px`, `.border-right-1px`, `.border-bottom-1px`, `.border-left-1px`。 + +```stylus +@import "./variable.styl" + +body, html + line-height: 1 + font-family: 'PingFang SC', 'STHeitiSC-Light', 'Helvetica-Light', arial, sans-serif, 'Droid Sans Fallback' + user-select: none + -webkit-tap-highlight-color: transparent + +.clear-fix + &::after + content: "" + display: table + clear: both + +.border-top-1px, .border-right-1px, .border-bottom-1px, .border-left-1px + position: relative + &::before, &::after + content: "" + display: block + position: absolute + transform-origin: 0 0 + +.border-top-1px + &::before + border-top: 1px solid $color-row-line + left: 0 + top: 0 + width: 100% + transform-origin: 0 top + +.border-right-1px + &::after + border-right: 1px solid $color-col-line + top: 0 + right: 0 + height: 100% + transform-origin: right 0 + +.border-bottom-1px + &::after + border-bottom: 1px solid $color-row-line + left: 0 + bottom: 0 + width: 100% + transform-origin: 0 bottom + +.border-left-1px + &::before + border-left: 1px solid $color-col-line + top: 0 + left: 0 + height: 100% + transform-origin: left 0 + +@media (min-resolution: 2dppx) + .border-top-1px + &::before + width: 200% + transform: scale(.5) translateZ(0) + .border-right-1px + &::after + height: 200% + transform: scale(.5) translateZ(0) + .border-bottom-1px + &::after + width: 200% + transform: scale(.5) translateZ(0) + .border-left-1px + &::before + height: 200% + transform: scale(.5) translateZ(0) + +@media (min-resolution: 3dppx) + .border-top-1px + &::before + width: 300% + transform: scale(.333) translateZ(0) + .border-right-1px + &::after + height: 300% + transform: scale(.333) translateZ(0) + .border-bottom-1px + &::after + width: 300% + transform: scale(.333) translateZ(0) + .border-left-1px + &::before + height: 300% + transform: scale(.333) translateZ(0) +``` + +### 内置 icon + +图标是利用 [font-face](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face) 规则自定义字体 `"cube-icon"` 实现的。 + +内置 icon 有 13 个: + +![cube icons](https://raw.githubusercontent.com/didi/cube-ui/master/assets/icon.png) + +使用的时候只需要加入对应的类名即可,例如 alert 图标,可以这样用:``。 diff --git a/document/components/docs/en-US/time-picker.md b/document/components/docs/en-US/time-picker.md new file mode 100644 index 000000000..71743ca2f --- /dev/null +++ b/document/components/docs/en-US/time-picker.md @@ -0,0 +1,128 @@ +## TimerPicker组件 + +日期选择器。`TimerPicker`组件基于`picker`组件再次封装。第一列为日期,第二列为小时,第三列为分钟数,显示的数据都是依据当前时间,及配置的参数来动态生成。在实现的过程当中,每一列的`picker`都对应一个`better-scroll`的实例,滚轴发生变化后,`picker`向`time-picker`派发`change`事件,再由`time-picker`向父元素派发`change`事件,`cancel`, `select`事件同理。 + +### 单独引入 + +```javascript + import { TimePicker } from 'cube-ui' + + export default { + components: { + CubeTimePicker: TimePicker + } + } +``` + +### 调用方式 + +通过在`time-picker`组件上添加`ref`属性,获得对于组件的引用,然后调用`time-picker`组件向外暴露出来的`show`,`hide`方法来控制组件的显示或消失,`show`能接受回调函数: + +```html + + + +``` + +### 示例 + +```html + + + +``` + +### API + +#### Props参数配置 + +| 参数 | 说明 | 类型 | 默认值 | +| ------------- |:-------------:| -----:| ---| +| title | 标题 | String | '选择时间' | +| delay | 将当前时间向后推算的分钟数,决定了最小可选时间 | 15 | +| day | 日期配置 | Object | { len: 3, filter: ['今日'], format: 'M月d日' } | +| showNow | 是否显示当前时间 | Boolean | true | +| minuteStep | 分钟数的步长 | Number | 10 | + +其中`day`属性可配置的参数有: + +| 参数 | 说明 | 类型 | 默认值 | +| ------------- |:-------------:| ----- | ---| +| len | 日期列,从当前时间算起,往后推len天 | Number | 3 | +| filter | 日期列,将时间映射为filter中的文案内容 | Array | ['今日'] | +| format | 时间格式化 | String | 'M月d日' | + +#### Event事件 + +| 事件名 | 说明 | 参数1 | 参数2 | +| ----- | ---- | ----| --- | +| select | 点击确认按钮触发此事件 | selectedTime: 当前选中的timestamp | selectText: 当前选中的时间文案 | +| change | 滑动改变time-picker滚轴时触发此事件 | selectedTime: 当前选中的timestamp | selectText: 当前选中的时间文案 | +| cancel | 点击取消按钮触发此事件 | - | - | + +#### 组件向外暴露方法 + +| 方法名 | 说明 | +| ----- | ---- | +| show | 拉起time-picker组件 | +| hide | 隐藏time-picker组件 | +| setTime | 手动设置time-picker组件显示的时间,数据格式为unix时间戳 | diff --git a/document/components/docs/en-US/tip.md b/document/components/docs/en-US/tip.md new file mode 100644 index 000000000..94b788bf7 --- /dev/null +++ b/document/components/docs/en-US/tip.md @@ -0,0 +1,107 @@ +## Tip + +`Tip`, used to popup tip bubble box. + +### Example + +- Basic usage + +By adding `ref` to `Tip`, you can get the reference to the component and invoke `show` or `hide` methods which are exposed by `Tip` to control the show or hide state of the component. + +```html +
+ +
+``` +```javascript +export default { + methods: { + showTip () { + this.$refs.tip.show() + } + } +} +``` + +- The position of the small triangle and the bubble box + +You can configure the direction of the small triangle by `direction` and configure the position of the bubble box by `style`. Normally, the direction of the small triangle is opposite to the position of the bubble box. + +```html +

+ CubeUI + +

Awesome!
+ +

+ +top +bottom +left +right +``` +```javascript +export default { + data() { + return { + direction: '', + tipStyle: '' + } + }, + methods: { + showTip(direction) { + this.direction = direction + this.$refs.tip.show() + + switch (direction) { + case 'top': + this.tipStyle = 'left: 100px; top: 100px;' + break + case 'bottom': + this.tipStyle = 'left: 100px; top: 20px;' + break + case 'left': + this.tipStyle = 'left: 200px; top: 60px;' + break + case 'right': + this.tipStyle = 'left: 5px; top: 60px;' + break + } + }, + close() { + console.log('click close button') + }, + clickHandler() { + console.log('click tip area') + } + } +} +``` + +### Props configuration + +| Attribute | Description | Type | Accepted Values | Default | +| - | - | - | - | - | +| direction | the direction of the small triangle | String | top/bottom/left/right | left | +| offsetLeft | the distance between the small triangle and the left part of x axis | Number | - | 0 | +| offsetTop | the distance between the small triangle and the origin of y axis | Number | - | 0 | +| offsetRight | the distance between the small triangle and the right part of x axis | Number | - | 0 | +| offsetBottom | the distance between the small triangle and the bottom part of y axis | Number | - | 0 | + +### Slot + +| name | description | +| - | - | +| - | the content shown inside the tip component | + +### Events + +| Event Name | Description | Parameters | +| - | - | - | +| close | the event that exposed when clicking the close button of tips, which will hide at the same time | None | +| clicked | the event that exposed when clicking the content of tips, which will hide at the same time | None | diff --git a/document/components/docs/en-US/toast.md b/document/components/docs/en-US/toast.md new file mode 100644 index 000000000..864242ae7 --- /dev/null +++ b/document/components/docs/en-US/toast.md @@ -0,0 +1,87 @@ +## Toast + +`Toast` component.You can use it to show modaless tip message without user interaction. + +### Example + +- Duration of display + + ```html + Toast - time 1s + Toast - time 0 + ``` + ```js + export default { + methods: { + showToastTime() { + const toast = this.$createToast({ + time: 1000, + txt: 'Toast time 1s' + }) + toast.show() + }, + showToastTime0() { + const toast = this.$createToast({ + time: 0, + txt: 'Toast time 0' + }) + toast.show() + setTimeout(() => { + toast.hide() + }, 2000) + } + } + } + ``` + + Set `time` to change the duration of display.If set to 0, it will not turn off automatically and you must invoke the component's `hide` method manually to trun off it. + +- Show mask layer + + ```html + Toast- with mask + ``` + ```js + export default { + methods: { + showToastMask () { + const toast = this.$createToast({ + txt: 'Loading...', + mask: true + }) + toast.show() + } + } + } + ``` + + Set `mask` to `true` to display mask. + +- Tip type + + ```html + Toast - type + ``` + ```js + export default { + methods: { + showToastType() { + const toast = this.$createToast({ + txt: 'Correct', + type: 'correct' + }) + toast.show() + } + } + } + ``` + Set `type` to change the tip icon.You can see accepted types in the following `Props configuration`. + +### Props configuration + +| Attribute | Description | Type | Accepted Values | Default | +| - | - | - | - | - | +| type | toast type(different types of icons) | String | loading/correct/error/warn | loading | +| mask | whether to show mask layer | Boolean | true/false | false | +| txt | tip text | String | - | '' | +| time | display duration, millisecond | Number | - | 3000 | diff --git a/document/components/docs/zh-CN.vue b/document/components/docs/zh-CN.vue new file mode 100644 index 000000000..b15e56023 --- /dev/null +++ b/document/components/docs/zh-CN.vue @@ -0,0 +1,16 @@ + + + + + diff --git a/document/components/docs/zh-CN/action-sheet.md b/document/components/docs/zh-CN/action-sheet.md new file mode 100644 index 000000000..b85cb92b7 --- /dev/null +++ b/document/components/docs/zh-CN/action-sheet.md @@ -0,0 +1,130 @@ +## ActionSheet + +`ActionSheet`操作列表提供了两种常见的样式,灵活可控内容。 + +### 示例 + +- 基本用法 + + ```html + 操作列表 + ``` + ```js + export default { + methods: { + showDefault() { + this.$createActionSheet({ + title: '我是标题~~~', + data: [ + { + content: '舒适型', + class: 'cube-foo' + }, + { + content: '七座商务', + align: 'left' + }, + { + content: '豪华型', + align: 'right' + } + ], + onSelect: (item, index) => { + this.$createToast({ + txt: `Clicked ${item.content}`, + time: 1000 + }).show() + } + }).show() + } + } + } + ``` + + 配置标题 `title` 和 `data` 数据项,注意 `data` 中内容是 `content`,一段 HTML 字符串,额外还可以配置自定义 class:`class` 和方向:`align`(值可以是 `left`、`right`)。 + +- 高亮设置 + + ```html + ActionSheet - active + ``` + ```js + export default { + methods: { + showActive() { + this.$createActionSheet({ + title: '我是标题~~~', + active: 0, + data: [ + { + content: '舒适型' + }, + { + content: '七座商务' + }, + { + content: '豪华型' + } + ] + }).show() + } + } + } + ``` + + 通过设置 `active` 属性来控制高亮的是第几个。 + +- Picker 样式设定 + ```html + ActionSheet - picker style + ``` + ```js + export default { + methods: { + showPickerStyle() { + this.$createActionSheet({ + title: '我是标题~~~', + pickerStyle: true, + data: [ + { + content: '舒适型' + }, + { + content: '七座商务' + }, + { + content: '豪华型' + } + ] + }).show() + } + } + } + ``` + + `pickerStyle` 属性决定是否使用 Picker 样式。 + + +### Props 配置 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| - | - | - | - | - | +| title | 组件的标题 | String | - | '' | +| data | 需要展示的数据列表 | Array | - | [] | +| active | 高亮第几个选项 | Number | - | -1 | +| pickerStyle | Picker 样式 | Boolean | true/false | false | + +* `data` 子配置项 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| - | - | - | - | - | +| content | 展示的内容 | String | 任意 HTML 字符串 | '' | +| align | 内容对齐方向 | String | left/right | '' | +| class | 自定义 class | String | - | '' | + +### 事件 + +| 参数 | 说明 | 参数1 | 参数2 | +| - | - | - | - | +| cancel | 点击取消 | - | - | +| select | 点击某项 | 点击项 item,即 data[index] | 点击项的索引值 index | diff --git a/document/components/docs/zh-CN/better-scroll.md b/document/components/docs/zh-CN/better-scroll.md new file mode 100644 index 000000000..384caeeb2 --- /dev/null +++ b/document/components/docs/zh-CN/better-scroll.md @@ -0,0 +1,11 @@ +## better-scroll 模块 + +该模块默认暴露出一个 `BScroll` 函数对象,这个对象直接从依赖库 [better-scroll](https://github.com/ustbhuangyi/better-scroll) 获得。 + +### 链接 + +关于 better-scroll 详细的文档以及示例,请参考: + +- [官方文档](https://ustbhuangyi.github.io/better-scroll/#/zh) + +- [官方示例](https://ustbhuangyi.github.io/better-scroll/#/examples/zh) diff --git a/document/components/docs/zh-CN/button.md b/document/components/docs/zh-CN/button.md new file mode 100644 index 000000000..97b6fd8cb --- /dev/null +++ b/document/components/docs/zh-CN/button.md @@ -0,0 +1,56 @@ +## Button + +按钮,提供了各种类型、样子、状态以及图标。 + +### 示例 + +- 按钮类型 + + 默认类型为 `button`,还可设置为 `submit` 用于表单中 + ```html + Button + Submit Button + ``` + +- 按钮状态 + + 默认正常,可设置激活、禁用状态 + ```html + Active Button + Disabled Button + ``` +- 图标 + + 可设置 icon 的 class + ```html + Button With Icon + ``` + +- 样子 + + 可以通过设置 `light`、`inline`、`outline`、`primary` 属性来改变按钮样子 + ```html + Light Button + Inline Button + Outline Button + Primary Button + ``` + +### Props 配置 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| - | - | - | - | - | +| type | 按钮类型 | String | button/submit | button | +| active | 激活状态 | Boolean | true/false | false | +| disabled | 禁用状态 | Boolean | true/false | false | +| icon | 图表 Icon | String | icon 的 class 值 | - | +| light | 亮色 | Boolean | true/false | false | +| inline | 是否内联 | Boolean | true/false | false | +| outline | 外边框 | Boolean | true/false | false | +| primary | 主要的 | Boolean | true/false | false | + +### 事件 + +| 事件名 | 说明 | 参数 | +| - | - | - | +| click | 点击按钮后触发此事件,如果禁用状态,则不触发 | e - 事件对象 | diff --git a/document/components/docs/zh-CN/checkbox-group.md b/document/components/docs/zh-CN/checkbox-group.md new file mode 100644 index 000000000..d3173845a --- /dev/null +++ b/document/components/docs/zh-CN/checkbox-group.md @@ -0,0 +1,50 @@ +## CheckboxGroup 复选框组 + +复选框组就是一组复选框,主要用来选择一组可选项;有垂直和水平两种样式。 + +### 示例 + +- 垂直排列 + + 默认就是垂直排列样式 + ```html + + + Checkbox 1 + + + Checkbox 2 + + + Disabled Checkbox + + + Disabled & Checked Checkbox + + + ``` + `checkList` 的值是一个数组,代表的是选中的复选框 `label` 的值的集合。 + +- 水平排列 + + 可通过设置 `horizontal` 改变样式为水平排列 + ```html + + 1 + 2 + 3 + 4 + + ``` + +### Props 配置 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| - | - | - | - | - | +| horizontal | 是否水平排列 | Boolean | true/false | false | + +### 事件 + +| 事件名 | 说明 | 参数 | +| - | - | - | +| input | 组内可选项选中状态发生改变时触发 | 选中的复选框的值的集合,类型数组 | diff --git a/document/components/docs/zh-CN/checkbox.md b/document/components/docs/zh-CN/checkbox.md new file mode 100644 index 000000000..b1508c413 --- /dev/null +++ b/document/components/docs/zh-CN/checkbox.md @@ -0,0 +1,48 @@ +## Checkbox 复选框 + +复选框,可设置其状态、传入特殊 class 以及复选框图标位置。 + +### 示例 + +- 基本用法 + ```html + + Checkbox + + ``` + 如果选中了,则 `checked` 的值就为 `true`。 +- 禁用状态 + ```html + + Disabled Checkbox + + ``` + 设置 `disabled` 为 `true` 即为禁用状态 +- 复选框图标位置 + ```html + + Position Checkbox + + ``` + 设置 `position` 为 `'right'` 则复选框图标位置在右边 +- 改变 model 的值 + ```html + + Set label Checkbox + + ``` + 设置 `label`,当复选框选中的时候,`checked` 的值就是 `'labelValue'`,当未选中的时候,`checked` 的值就是 `false`;所以其实在单个复选框的场景下,最好不要设置 `label`。 + +### Props 配置 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| - | - | - | - | - | +| disabled | 是否被禁用 | Boolean | true/false | false | +| position | 位置 | String | left/right | left | +| label | 如果选中的话,则是把该值映射到 v-model 上 | Boolean/String | - | '' | + +### 事件 + +| 事件名 | 说明 | 参数 | +| - | - | - | +| input | 选中状态发生改变时触发 | 设置的 label 的值或者是否选中的布尔值 | diff --git a/document/components/docs/zh-CN/create-api.md b/document/components/docs/zh-CN/create-api.md new file mode 100644 index 000000000..585fe1849 --- /dev/null +++ b/document/components/docs/zh-CN/create-api.md @@ -0,0 +1,80 @@ +## create-api 模块 + +该模块默认暴露出一个 `createAPI` 函数,可以实现以 API 的形式调用自定义组件。 + +### createAPI(Vue, Component, [events, single]) + +- 参数: + + - `{Function} Vue` Vue 函数 + - `{Function | Object} Component` 组件类或者组件对象,组件必须有 name + - `{Array} [events]` 组件实例 emit 的事件名集合 + - `{Boolean} [single]` 是否为单例 + +- 用法: + + - 该方法主要是在 Vue 的 prototype 上增加一个名为 `$create{camelize(Component.name)}` 的方法,这样就可以在其他组件中直接通过 `const instance = this.$createAaBb(config, [renderFn])` 这样来实例化组件了,而且这个实例化组件的元素是被附加到 `body` 元素下的;关于 `$createAaBb` 的参数: + - `{Object} config` 组件配置参数,默认所有的值都会当做 props 传给组件,但是要排除 `events` 中的事件(默认会做转换,例如:`events` 的值为 `['click']`,那么 `config` 中的 `onClick` 就是作为 `click` 事件的回调函数,而不是作为 props 传递给组件)。 + - `{Function} [renderFn]` 是可选的参数,用于生成子 VNode 节点,一般场景是处理 slot。 + - 注意调用后的返回值 `instance` 就是组件实例,这个实例会被**附加**或者**代理** `remove` 方法,如果调用了,该实例就会被销毁且会从 `body` 下移除。 + +- 示例: + + ```js + import Vue form 'vue' + // 得到 createAPI + import { createAPI } from 'cube-ui' + // or import Cube from 'cube-ui' + // const { createAPI } = Cube + // 需要提供 API 方式实例化的组件 + const MyComponent = Vue.extend({ + name: 'hello', + props: { + content: { + type: String, + default: 'Hello' + } + }, + template: '
{{content}}
', + methods: { + clickHandler(e) { + this.$emit('click', e) + } + } + }) + // 调用 + createAPI(Vue, MyComponent, ['click'], true) + // 在其他组件中使用 + new Vue({ + el: '#app', + template: '', + methods: { + showHello() { + // 直接调用 + // 传入配置对象,默认传入的所有对象全都当做 props 传入组件 + // 除了在调用 createAPI 的时候传入了 events,这里对应的就是 + // on{event name} 会被当做事件回调处理 + const instance = this.$createHello({ + content: 'My Hello Content', + onClick(e) { + console.log('Hello component clicked.') + } + }, /* renderFn */ (createElement) => { + return [ + createElement('p', { + slot: 'other' + }, 'other content') + ] + }) + // 通过 Vue 组件的 $on 也是可以监听的,看使用场景 + instance.$on('click', (e) => { + console.log('on click', e) + }) + // 移除销毁 + instance.remove() + } + } + }) + ``` + + 示例中就是创建了一个需要 API 调用的组件 `MyComponent`,名字为 `hello`,然后在其他组件中去使用,重点就是 `showHello()` 方法做的事情:调用 `this.$createHello(config, renderFn)` 实现组件的实例化。 diff --git a/document/components/docs/zh-CN/dialog.md b/document/components/docs/zh-CN/dialog.md new file mode 100644 index 000000000..064333564 --- /dev/null +++ b/document/components/docs/zh-CN/dialog.md @@ -0,0 +1,176 @@ +## Dialog + +`Dialog`模态框组件,提供了多种样式及交互形式。 + +### 示例 + +- 类型设置 + + ```html + Dialog - type + ``` + ```js + export default { + methods: { + showAlert() { + this.$createDialog({ + type: 'alert', + title: '我是标题', + content: '我是内容', + icon: 'cubeic-alert' + }).show() + } + } + } + ``` + + `type` 可选的值为 `alert` (对应为提示框)、`confirm` (对应为确认框)。 + +- 按钮设置 + + ```html + Dialog - btn + ``` + ```js + export default { + methods: { + showBtn() { + this.$createDialog({ + type: 'confirm', + icon: 'cubeic-alert', + title: '我是标题', + content: '我是内容', + confirmBtn: { + text: '确定按钮', + active: true, + href: 'javascript:;' + }, + cancelBtn: { + text: '取消按钮', + active: false, + href: 'javascript:;' + } + }).show() + } + } + } + ``` + + 按钮设置可接受 `String` 或 `Object` 类型数据,当传入 `Object` 类型的数据时,可通过 `text` 字段来设置按钮文案内容、`active` 字段来设置按钮文案是否高亮、`href` 字段为按钮的跳转链接。 + +- 关闭按钮 + + ```html + Dialog - show close + ``` + ```js + export default { + methods: { + showClose() { + this.$createDialog({ + type: 'alert', + icon: 'cubeic-alert', + showClose: true, + title: '标题', + onClose: () => { + this.$createToast({ + type: 'warn', + time: 1000, + txt: '点击关闭按钮' + }).show() + } + }).show() + } + } + } + ``` + + `showClose` 字段决定是否需要显示关闭按钮,同时点击关闭按钮会触发 `close` 事件,如果传入了 `onClose` 则会被调用。 + +- 插槽 + + ```html + Dialog - slot + ``` + ```js + export default { + methods: { + showSlot() { + this.$createDialog({ + type: 'alert', + confirmBtn: { + text: '我知道了', + active: true + } + }, (createElement) => { + return [ + createElement('div', { + 'class': { + 'my-title': true + }, + slot: 'title' + }, [ + createElement('div', { + 'class': { + 'my-title-img': true + } + }), + createElement('p', '附近车少,优选出租车将来接您') + ]), + createElement('p', { + 'class': { + 'my-content': true + }, + slot: 'content' + }, '价格仍按快车计算') + ] + }).show() + } + } + } + ``` + + `$createDialog` 的第二个参数是 [render 函数](https://vuejs.org/v2/guide/render-function.html),一般用于处理插槽的场景;Dialog 组件提供了 2 个具名的插槽 `title` 和 `content`,分别用来分发标题和内容。 + +### Props 配置 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| - | - | - | - | - | +| type | 类型 | String | 提示框 alert / 确认框 confirm | alert | +| icon | 图标的 class 名 | String | [参照 style 模块下的内置 icon 部分](#/style) | '' | +| title | 标题 | String | - | '' | +| content | 正文 | String | - | '' | +| showClose | 是否显示关闭按钮 | Boolean | true/false | false | +| confirmBtn | 确认按钮参数配置 | Object/String | - | { text: '确定', active: true, href: 'javascript:;' } | +| cancelBtn | 取消按钮参数配置 | Object/String | - | { text: '取消', active: false, href: 'javascript:;' } | + +* `confirmBtn` 子配置项 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| - | - | - | - | - | +| text | 按钮文案 | String | - | '确认' | +| active | 是否高亮 | Boolean | true/false | true | +| href | 点击按钮后的跳转链接 | String | - | 'javascript:;' | + +* `cancelBtn` 子配置项 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| - | - | - | - | - | +| text | 按钮文案 | String | - | '取消' | +| active | 是否高亮 | Boolean | true/false | false | +| href | 点击按钮后的跳转链接 | String | - | 'javascript:;' | + +### 插槽 + +| 名字 | 说明 | 作用域参数 | +| - | - | - | +| title | 标题 | - | +| content | 内容 | - | + +### 事件 + +| 事件名 | 说明 | 参数 | +| - | - | - | - | +| confirm | 点击确认按钮后触发 | 事件对象 e | +| cancel | 点击取消按钮后触发 | 事件对象 e | +| close | 点击关闭按钮后触发 | 事件对象 e | diff --git a/document/components/docs/zh-CN/index-list.md b/document/components/docs/zh-CN/index-list.md new file mode 100644 index 000000000..5eb6929c2 --- /dev/null +++ b/document/components/docs/zh-CN/index-list.md @@ -0,0 +1,89 @@ +## IndexList + +索引列表,提供了列表索引的功能,也是一个基于`better-scroll`进行封装的组件。 + +### 示例 + +- 基本使用 + + 构造如示例中 `cityData` 这样结构的数据,传入 `cube-index-list` 组件的 `data` 属性。 + + ```html + + ``` + ```javascript + const cityData = [ + { + "name": "★Hot City", + "items": [ + { + "name": "BEIJING", + "value": 1 + }, + { + "name": "SHANGHAI", + "value": 2 + } + ] + }, + { + "name": "A", + "items": [ + { + "name": "ANSHAN", + "value": 3 + }, + { + "name": "ANQING", + "value": 4 + } + ] + } + ] + + export default { + data() { + return { + title: 'Current City: BEIJING', + cityData: cityData + } + }, + methods: { + selectItem(item) { + console.log(item.name) + }, + clickTitle(title) { + console.log(title) + } + } + } + ``` + +### Props 配置 + +| 参数 | 说明 | 类型 | 默认值 | +| - | - | - | - | +| title | 标题 | String | - | +| data | 需要展示的数据 | Array | [] | + +- `data` 子配置项 + +`data` 是数组,表示的是一组数据,每一项配置: + +| 参数 | 说明 | 类型 | +| - | - | - | +| name | 组名 | String | +| items | 当前组下的数据项 | Array | + +`items` 数组中的每一项必须是对象,且包含 `name` 属性用于显示内容;例如 `items`: `[{name: 'xx', ...}, ...]` + +### 事件 + +| 事件名 | 说明 | 参数 | +| - | - | - | +| select | 点击 IndexList 的某一项后触发 | 该选项的数据 | +| title-click | 点击 title 后触发(title 必须设置后才有效) | title属性值 | diff --git a/document/components/docs/zh-CN/install.md b/document/components/docs/zh-CN/install.md new file mode 100644 index 000000000..517808bb9 --- /dev/null +++ b/document/components/docs/zh-CN/install.md @@ -0,0 +1,24 @@ +## 安装 + + +### NPM + +推荐使用 NPM 安装`cube-ui` + +```shell +$ npm install cube-ui +``` + + +### CDN + +也可通过 unpkg.com 获取资源,用标签引入 js 和 css 文件使用。 + +```html + + +``` + +### 版本日志 + +版本的更新日志见 [GitHub](https://github.com/didi/cube-ui/releases) diff --git a/document/components/docs/zh-CN/introduction.md b/document/components/docs/zh-CN/introduction.md new file mode 100644 index 000000000..04c0ab390 --- /dev/null +++ b/document/components/docs/zh-CN/introduction.md @@ -0,0 +1,122 @@ +## 介绍 + +cube-ui 是基于 Vue.js 实现的精致移动端组件库。 + +### 特性 + +- **质量可靠** + + 由滴滴内部组件库精简提炼而来,经历了业务一年多的考验,并且每个组件都有充分单元测试,为后续集成提供保障。 + +- **体验极致** + + 以迅速响应、动画流畅、接近原生为目标,在交互体验方面追求极致。 + +- **标准规范** + + 遵循统一的设计交互标准,高度还原设计效果;接口标准化,统一规范使用方式,开发更加简单高效。 + +- **扩展性强** + + 支持按需引入和后编译,轻量灵活;扩展性强,可以方便地基于现有组件实现二次开发。 + +### 组件 + +#### 基础 + +- [Button 按钮](#/zh-CN/docs/button) +- [Checkbox 复选框](#/zh-CN/docs/checkbox) +- [CheckboxGroup 复选框组](#/zh-CN/docs/checkbox-group) +- [Loading 加载中](#/zh-CN/docs/loading) +- [Tip 提示](#/zh-CN/docs/tip) + +#### 弹层 + +- [Toast 提醒](#/zh-CN/docs/toast) +- [Picker 选择器](#/zh-CN/docs/picker) +- [TimePicker 时间选择器](#/zh-CN/docs/time-picker) +- [Dialog 弹框](#/zh-CN/docs/dialog) +- [ActionSheet 操作菜单](#/zh-CN/docs/action-sheet) + +所有的弹层类组件可以通过组件调用和 API 调用,来看示例(`Toast` 为例): + +组件调用: + +```html + + +``` + +API 调用: + +```html + + +``` + +两种方式都可以,但是我们推荐后者,通过 `$createXxYy` API 来调用;通过 API 调用的话,这个弹框是附加到 `body` 元素下的,这样的好处是可以不受外层样式的影响,因为组件调用的话,很容易受到外层 `transform`, `overflow` 等样式的影响。 + +注意这个 API 的名字的组合就是:`$create` + `${组件名字}`,例如 `ActionSheet` 组件的话,API 名字就是 `$createActionSheet`。 + +#### 滚动 + +- [Scroll 滚动](#/zh-CN/docs/scroll) +- [Slide 幻灯片](#/zh-CN/docs/slide) +- [IndexList 索引列表](#/zh-CN/docs/index-list) + +滚动类组件都是基于 [better-scroll](https://github.com/ustbhuangyi/better-scroll) 实现,而 `Scroll` 组件就是对 better-scroll 的封装。 + +### 模块 + +除了组件之外,cube-ui 还有一些特殊的模块。 + +#### style + +样式部分,如果你是在按需引入使用的场景下,那么建议在入口文件处也要引入这个模块,因为它包含基础的 reset、基础通用样式以及内置 icon。 + +详见 [style 模块](#/zh-CN/docs/style)。 + +#### create-api + +有些时候,开发者可能也需要自己封装的组件支持 API 式调用,此时可以通过引入 create-api 模块或者通过全局的 `Cube.createAPI` 接口来达到封装目的。 + +详见 [create-api 模块](#/zh-CN/docs/create-api)。 + +#### better-scroll + +[better-scroll](https://github.com/ustbhuangyi/better-scroll) 是组件库依赖的一个库,为了避免重复引入问题,我们暴露出了这个模块。 + +详见 [better-scroll 模块](#/zh-CN/docs/better-scroll)。 diff --git a/document/components/docs/zh-CN/loading.md b/document/components/docs/zh-CN/loading.md new file mode 100644 index 000000000..a2d40a7d8 --- /dev/null +++ b/document/components/docs/zh-CN/loading.md @@ -0,0 +1,21 @@ +## Loading + +加载,提供了可自定义大小的加载动画。 + +### 示例 + +- 图标大小 + + 默认大小为`24px`,可通过`size`属性配置 + + ```html + + + + ``` + +### Props 配置 + +| 参数 | 说明 | 类型 | 默认值 | +| - | - | - | - | +| size | 加载图标的大小,单位px | Number | 24 | diff --git a/document/components/docs/zh-CN/picker.md b/document/components/docs/zh-CN/picker.md new file mode 100644 index 000000000..1b292c0ff --- /dev/null +++ b/document/components/docs/zh-CN/picker.md @@ -0,0 +1,161 @@ +## Picker组件 + +Picker 组件支持多列选择器及数据联动。 + +### 示例 + +- 基本用法 + ```html + Picker + ``` + ```js + const col1Data = [{ text: '剧毒', value: 1}, { text: '蚂蚁', value: 2 }, { text: '幽鬼', value: 2 }] + export default { + mounted () { + this.picker = this.$createPicker({ + title: 'Picker选择器-单列', + data: [col1Data] + }) + }, + methods: { + showPicker () { + this.picker.show() + } + } + } + ``` + +- 多列选择器 + ```html + Picker - multiple Columns + ``` + ```js + const col1Data = [{ text: '剧毒', value: 1}, { text: '蚂蚁', value: 2 }, { text: '幽鬼', value: 3 }] + const col2Data = [{ text: '梅肯', value: 's'}, { text: '秘法鞋', value: 'ss' }, { text: '假腿', value: 'sss' }, { text: '飞鞋', value: 'ssss' }, { text: '辉耀', value: 'sssss' }, { text: '金箍棒', value: 'ssssss' }] + export default { + mounted () { + this.picker = this.$createPicker({ + title: 'Picker选择器-多列', + data: [col1Data, col2Data] + }) + }, + methods: { + showPicker () { + this.picker.show() + } + } + } + ``` + `data`字段接收一个数组,其长度决定了`picker`的列数。 + +- 联动选择器 + ```html + Picker - linkage + ``` + ```js + import { provinceList, cityList, areaList } from '../data/area' + + export default { + data () { + return { + tempIndex: [0, 0, 0] + } + }, + mounted () { + this.picker = this.$createPicker({ + title: 'Picker-数据联动', + data: this.linkageData, + onChange: (i, newIndex) => { + if (newIndex !== this.tempIndex[i]) { + for (let j = 2; j > i; j--) { + this.tempIndex.splice(j, 1, 0) + this.picker.scrollTo(j, 0) + } + + this.tempIndex.splice(i, 1, newIndex) + this.picker.setData(this.linkageData, this.tempIndex) + } + }, + onSelect: (selectedVal) => { + console.log(selectedVal) + } + }) + }, + watch: { + linkageData() { + this.picker.refresh() + } + }, + computed: { + linkageData() { + const provinces = provinceList + const cities = cityList[provinces[this.tempIndex[0]].value] + const areas = areaList[cities[this.tempIndex[1]].value] + + return [provinces, cities, areas] + } + } + methods: { + showPicker () { + this.picker.show() + } + } + } + ``` + 通过监听每个滚轴触发的`change`事件,然后调用`setData`方法去动态设置相关联的滚轴的值来完成联动选择的功能。 + +- 实例方法 `setData` + ```html + Picker - setData + ``` + ```js + const col1Data = [{ text: '剧毒', value: '剧毒'}, { text: '蚂蚁', value: '蚂蚁' }, { text: '幽鬼', value: '幽鬼' }] + const col2Data = [{ text: '梅肯', value: '梅肯'}, { text: '秘法鞋', value: '秘法鞋' }, { text: '假腿', value: '假腿' }, { text: '飞鞋', value: '飞鞋' }, { text: '辉耀', value: '辉耀' }, { text: '金箍棒', value: '金箍棒' }] + const col3Data = [{ text: '输出', value: '输出'}, { text: '控制', value: '控制' }, { text: '核心', value: '核心' }, { text: '爆发', value: '爆发'}, { text: '辅助', value: '辅助' }] + export default { + mounted () { + this.picker = this.$createPicker({ + title: 'Picker-setData' + }) + }, + methods: { + showPicker () { + this.picker.setData([col1Data, col2Data, col3Data], [1, 2, 3]) + this.picker.show() + } + } + } + ``` + 实例方法`setData`可接受2个参数,都为数组类型。第一个参数为滚轴需要显示的数据,第二个参数为选中值的索引。 + +### Props 配置 + +| 参数 | 说明 | 类型 | 默认值 | 示例 | +| - | - | - | - | - | +| title | 标题 | String | '' | - | +| data | 传入picker数据,数组的长度决定了picker的列数 | Array | [] | - | +| cancelTxt | picker左侧按钮文案 | String | '取消' | - | +| confirmTxt | picker右侧按钮文案 | String | '确定' | - | +| selectIndex | 被选中的索引值,拉起picker后显示这个索引值对应的内容 | Array | [] | [1] | + +* `data`子配置项 + +| 参数 | 说明 | 类型 | 默认值 | 示例 | +| - | - | - | - | - | +| text | picker每一列展示的文案 | String/Number | - | - | +| value | picker每一列展示的每项文案对应的值 | String/Number/Boolean | - | - | + +### 事件 + +| 事件名 | 说明 | 参数1 | 参数2 | +| - | - | - | - | +| select | 点击确认按钮触发此事件 | selectedVal: 当前选中项每一列的值,Array类型 | selectedIndex: 当前选中项每一列的索引,Array类型 | +| change | 滚轴滚动后触发此事件 | index: 当前滚动列次序,Number类型 | selectedIndex: 当前列选中项的索引,Number类型 | +| value-change | 所确认的值变化时触发此事件 | selectedVal: 当前确认项每一列的值,Array类型 | selectedIndex: 当前确认项每一列的索引,Array类型 | +| cancel | 点击取消按钮触发此事件 | - | - | + +### 实例方法 + +| 方法名 | 说明 | 参数1 | 参数2 | +| - | - | - | - | +| setData | 设置picker可选项 | picker每列可选项的文案和值,Array类型 | picker每列选中的索引,Array类型 | diff --git a/document/components/docs/zh-CN/popup.md b/document/components/docs/zh-CN/popup.md new file mode 100644 index 000000000..255658e98 --- /dev/null +++ b/document/components/docs/zh-CN/popup.md @@ -0,0 +1,125 @@ +## Popup 弹层 + +底层弹层组件,主要用于基于此组件实现上层组件封装,只提供了基础功能:指定类型、是否有背景层、显示内容(HTML)以及是否居中。 + +内置所有的弹层类组件都是基于此组件实现,包括:[Toast](#/zh-CN/docs/toast)、[Picker](#/zh-CN/docs/picker)、[TimePicker](#/zh-CN/docs/time-picker)、[Dialog](#/zh-CN/docs/dialog)、[ActionSheet](#/zh-CN/docs/action-sheet)。 + +### 示例 + +组件 + +- 基本用法 + ```html + + My Popup Content 1 + + + Show Popup + + ``` + 指定类型 `type`,这样方便根据类型做 class 控制,如示例,会在根元素上会增加 `cube-my-popup` 的 class + ```js + export default { + methods: { + showPopup(refId) { + const component = this.$refs[refId] + component.show() + setTimeout(() => { + component.hide() + }, 1000) + } + } + } + ``` + 组件默认是隐藏的,需要调用组件实例的 `show()` 方法才会显示,调用组件实例的 `hide()` 方法隐藏,这里的 `showPopup()` 就是做的这件事情(首先显示,1 秒钟后隐藏) +- 不要背景层 + ```html + + My Popup Content 2 + + + Show Popup - no mask + + ``` + 设置 `mask` 为 `false`,即不显示背景层 +- 显示内容 HTML + ```html + + + Show Popup - with content + + ``` + 只需要传入 `content`,内容是一段 HTML 片段 +- 置底 + ```html + + My Popup Content 4 + + + Show Popup - bottom + + ``` + 考虑移动端场景,大部分时候弹层类都是居中或置底的(置底的时候是在水平方向铺满的),所以如果设置了 `center` 为 `false` 的话,就是置底的效果 +- 上层封装 + ```html + + + + ``` + 这样就实现了一个上层封装的 CubeExtendPopup 组件,自带了一些样式,支持传入内容还有默认插槽,点击内容可隐藏。你可以这样使用(需要全局注册或者局部注册到使用的组件中): + ```html + + + Show Extend Popup + + ``` + +### Props 配置 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| - | - | - | - | - | +| type | 弹层类型 | String | - | '' | +| mask | 是否显示背景层 | Boolean | true/false | true | +| content | 内容,HTML 字符串,在无插槽的时候有效 | String | - | '' | +| center | 是否水平垂直居中的 | Boolean | true/false | true | + +### 事件 + +| 事件名 | 说明 | 参数 | +| - | - | - | +| mask-click | 背景层点击 | 点击事件对象 | diff --git a/document/components/docs/zh-CN/post-compile.md b/document/components/docs/zh-CN/post-compile.md new file mode 100644 index 000000000..f08cc015e --- /dev/null +++ b/document/components/docs/zh-CN/post-compile.md @@ -0,0 +1,87 @@ +## 后编译 + +后编译指的是应用依赖的 NPM 包并不需要在发布前编译,而是随着应用编译打包的时候一块编译。 + +_注:_ 关于后编译更详细内容可参阅 [webpack 应用编译优化之路](https://github.com/DDFE/DDFE-blog/issues/23) + +### 背景 + +使用 webpack + babel 开发应用越来越多,而且一般都是通过 NPM 进行包管理的,这样依赖包越来越多,这些依赖包也是使用的 ES2015+ 开发的,所以每个依赖包都需要编译才能发布,这样编译后代码中往往后包含很多编译代码,所以为了消除这部分冗余,推荐大家使用后编译。 + +### 优缺点 + +优点: + +- 公共的依赖可以实现共用,只此一份,重要的是只编译一次,建议通过 peerDependencies 管理依赖。 +- babel 转换 API(例如 babel-plugin-transform-runtime 或者 babel-polyfill)部分的代码只有一份。 +- 不用每个依赖包都需要配置编译打包环节,甚至可以直接源码级别发布。 + +缺点: + +- 主应用的 babel 配置需要能兼容依赖包的 babel 配置。 +- 依赖包不能使用 alias、不能方便的使用 DefinePlugin(可以经过一次简单编译,但是不做 babel 处理)。 +- 应用编译时间会变长。 + +### 约定 + +考虑到有些应用会使用后编译,有些则只能使用编译好的依赖包,为了“争夺”入口,cube-ui 做了均衡,约定: + +> package.json 的 main 字段指向的就是编译后入口,而 module 字段指向的就是源码入口。 + +_关于 [pkg.module](https://github.com/rollup/rollup/wiki/pkg.module)_ + +这样,如果应用使用的是 webpack 2+,则默认走后编译,而如果使用的 webpack 1.x 则默认使用的是编译后内容;当然,这部分可以通过 webpack 的 alias 配置达到和版本无关效果。 + +### webpack 配置使用 + +后编译的场景是极有可能产生嵌套的情况,而且对于每个依赖包而言应该自己管理自身需要后编译的依赖;为了解决这个问题,可以使用 [webpack-post-compile-plugin](https://www.npmjs.com/package/webpack-post-compile-plugin),只需要在应用或者 NPM 包自身的 package.json 中通过 compileDependencies 来指定自身需要后编译依赖的包名。 + +一个应用示例配置: + +```js +// webpack.config.js +var PostCompilePlugin = require('webpack-post-compile-plugin') + +module.exports = { + // ... + module: { + rules: [ + // ... + { + test: /\.js$/, + loader: 'babel-loader', + include: [ + resolve('src') + ] + }, + // ... + ] + }, + // ... + plugins: [ + new PostCompilePlugin() + ] +} +``` + +在应用的 package.json 中增加 compileDependencies: + +```json +// package.json +{ + // ... + "compileDependencies": ["A", "B"] + // ... +} +``` + +如果说 A 还依赖 C 的话,只需要在 A 的 package.json 中指定 compileDependencies 即可: + +```json +// A package.json +{ + // ... + "compileDependencies": ["C"] + // ... +} +``` diff --git a/document/components/docs/zh-CN/quick-start.md b/document/components/docs/zh-CN/quick-start.md new file mode 100644 index 000000000..05c37a4a0 --- /dev/null +++ b/document/components/docs/zh-CN/quick-start.md @@ -0,0 +1,114 @@ +## 快速上手 + +### 安装 + +```shell +$ npm install cube-ui --save +``` + +### 使用 + +推荐使用 [babel-plugin-transform-modules](https://www.npmjs.com/package/babel-plugin-transform-modules) 插件,可以更优雅引入组件模块以及对应的样式。 + +但在使用之前,需要配置下这个插件,修改 .babelrc: + +- webpack 1.x + ```json + { + "plugins": ["transform-modules", { + "cube-ui": { + "transform": "cube-ui/lib/${member}", + "kebabCase": true, + "style": true + } + }] + } + ``` +- webpack 2+ + ```json + { + "plugins": ["transform-modules", { + "cube-ui": { + "transform": "cube-ui/src/modules/${member}", + "kebabCase": true + } + }] + } + ``` + +> [为何要区分 webpack 版本?](#/zh-CN/docs/post-compile) + +如果不使用 babel-plugin-transform-modules 插件的话,需要手工引入对应的样式文件。 + +#### 全部引入 + +一般在入口文件中: + +```javascript +import Vue from 'vue' +import Cube from 'cube-ui' + +Vue.use(Cube) +``` + +#### 按需引入 + +```javascript +import { Button } from 'cube-ui' +``` + +你可以选择全局注册也可以选择局部注册: + +```js +// 全局注册 +Vue.use(Button) + +// 或者局部注册 +// 某个组件中 +{ + components: { + CubeButton: Button + } +} +``` + +所有的可按需引入的组件: + +```js +import { + Button, + Checkbox, + Loading, + Tip, + Toast, + Picker, + TimePicker, + Dialog, + ActionSheet, + Scroll, + Slide, + IndexList +} from 'cube-ui' +``` + +#### 示例 + +```html + + + +``` diff --git a/document/components/docs/zh-CN/scroll.md b/document/components/docs/zh-CN/scroll.md new file mode 100644 index 000000000..71cb3fe1a --- /dev/null +++ b/document/components/docs/zh-CN/scroll.md @@ -0,0 +1,229 @@ +## Scroll + +滚动列表,提供了优质的原生滚动体验,便捷的配置项和事件,是一个基于`better-scroll`进行封装的组件。 + +### 示例 + +- 基本使用 + + 通过设置 `data` 属性为一个数组,即可生成能够在容器内优雅滚动的列表。 + + ```html +
+ +
+ ``` + +- 滚动条 + + 默认无滚动条,还可设为淡入淡出滚动条或一直显示滚动条。 + + ```html + + + + + ``` + ```javascript + export default { + data() { + return { + items: [1, 2, 3, 4, 5], + scrollbar: { + fade: false + } + } + } + } + ``` + +- 下拉刷新 + + 默认无下拉刷新功能,可通过配置`pull-down-refresh`属性开启`pulling-down`事件派发和下拉动画,你可以监听`pulling-down`事件更新数据。 + + ```html + + + + + ``` + ```javascript + export default { + data() { + return { + items: [1, 2, 3, 4, 5], + pullDownRefresh: { + threshold: 90, + stop: 40, + txt: 'Refresh success' + } + } + }, + methods: { + onPullingDown() { + // 模拟更新数据 + setTimeout(() => { + if (Math.random() > 0.5) { + // 如果有新数据 + this.items.unshift('I am new data: ' + +new Date()) + } else { + // 如果没有新数据 + this.$refs.scroll.forceUpdate() + } + }, 1000) + } + } + } + ``` + +- 上拉加载 + + 默认无上拉加载功能,可通过配置`pull-up-load`属性开启`pulling-up`事件派发和上拉动画,你可以监听`pulling-up`事件更新数据。 + + ```html + + + + + ``` + ```javascript + export default { + data() { + return { + items: [1, 2, 3, 4, 5], + itemIndex: 5, + pullUpLoad: { + threshold: 0, + txt: { + more: 'Load more', + noMore: 'No more data' + } + } + } + }, + methods: { + onPullingUp() { + // 更新数据 + setTimeout(() => { + if (Math.random() > 0.5) { + // 如果有新数据 + let newPage = [ + 'I am line ' + ++this.itemIndex, + 'I am line ' + ++this.itemIndex, + 'I am line ' + ++this.itemIndex, + 'I am line ' + ++this.itemIndex, + 'I am line ' + ++this.itemIndex + ] + + this.items = this.items.concat(newPage) + } else { + // 如果没有新数据 + this.$refs.scroll.forceUpdate() + } + }, 1000) + } + } + } + ``` + +- 自定义下拉刷新和上拉加载动画 + + 如果你不喜欢内置的下载刷新插槽和上拉加载,还可以用[作用域插槽](https://cn.vuejs.org/v2/guide/components.html#作用域插槽)做自定义动画。下面这个示例,就是用作用域插槽对下拉刷新做了自定义动画,而上拉加载则保留了缺省的内置动画。 + ```html + + + + ``` + + 通过作用域插槽提供的作用域参数,你可以根据各个状态的变化来控制动画流程。具体的作用域参数及其含义详见下面的插槽。 + +### Props 配置 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| - | - | - | - | - | +| data | 用于列表渲染的数据 | Array | - | [] | +| direction | 滚动方向 | String | 'vertical', 'horizontal' | 'vertical' | +| scrollbar | 滚动条配置项 | Boolean/Object | - | false | +| pullDownRefresh | 下拉刷新配置项 | Boolean/Object | - | false | +| pullUpLoad | 上拉加载配置项 | Boolean/Object | - | false | +| listenScroll | 是否派发 scroll 事件 | Boolean | true/false | false | +| probeType | scroll 事件的派发时机
1为非实时派发;
2为滚动操作过程实时派发;
3为包括惯性滚动的整个滚动过程实时派发 | Number | 1, 2, 3 | 0 | +| listenBeforeScroll | 是否派发 before-scroll-start 事件 | Boolean | true/false | false | + +- `scrollbar` 子配置项 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| - | - | - | - | - | +| fade | 是否淡入淡出 | Boolean | true/false | false | + +- `pullDownRefresh` 子配置项 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| - | - | - | - | - | +| threshold | 下拉刷新动作的下拉距离阈值 | Number | - | 90 | +| stop | 回弹停留的位置 | Number | - | 40 | +| txt | 刷新成功的文案 | String | - | 'Refresh success' | + +- `pullUpLoad` 子配置项 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| - | - | - | - | - | +| threshold | 上拉刷新动作的上拉距离阈值 | Number | - | 0 | +| txt | 上拉加载的相关文案 | Object | - | { more: 'Load more', noMore: 'No more data' } | + +### 插槽 + +| 名字 | 说明 | 作用域参数 +| - | - | - | +| pulldown | 位于列表上方,会在下拉刷新时显示 | pullDownRefresh: 是否开启了下拉刷新功能
pullDownStyle: 移入移出的样式
beforePullDown: 是否正在做下拉操作
pulling: 是否正在拉取数据
bubbleY: 当前下拉的距离 - 50| +| pullup | 位于列表下方,会在上拉加载时显示 | pullUpLoad: 是否开启了上拉加载功能
isPullUpLoad: 是否正在加载数据 | + +### 事件 + +| 事件名 | 说明 | 参数 | +| - | - | - | +| click | 点击列表项时触发 | item - 该列表项的数据 | +| scroll | 当 listenScroll 为 true 时,根据 probeType 的值决定派发时机 | Object {x, y} - 滚动的实时坐标 | +| before-scroll-start | 当 listenBeforeScroll 属性为 true 时,在滚动开始之前触发 | - | +| pulling-down | 当 pullDownRefresh 属性为 true 时,在下拉超过阈值时触发 | - | +| pulling-up | 当 pullUpLoad 属性为 true 时,在上拉超过阈值时触发 | - | diff --git a/document/components/docs/zh-CN/slide.md b/document/components/docs/zh-CN/slide.md new file mode 100644 index 000000000..dd94d0553 --- /dev/null +++ b/document/components/docs/zh-CN/slide.md @@ -0,0 +1,104 @@ +## Slide + +轮播图,提供了常见的`轮播`及`swipe`的功能,也是一个基于`better-scroll`进行封装的组件。 + +### 示例 + +- 基本使用 + + `cube-slide`元素即整个轮播图组件,`cube-slide-item`元素则是每一个轮播的页面,其 slot 为该页的内容。 + + ```html + + + + + + + + ``` + ```javascript + export default { + data() { + return { + items: [ + { + url: 'http://www.didichuxing.com/', + image: '//webapp.didistatic.com/static/webapp/shield/cube-ui-examples-slide01.png' + }, { + url: 'http://www.didichuxing.com/', + image: '//webapp.didistatic.com/static/webapp/shield/cube-ui-examples-slide02.png' + }, { + url: 'http://www.didichuxing.com/', + image: '//webapp.didistatic.com/static/webapp/shield/cube-ui-examples-slide03.png' + } + ] + } + }, + methods: { + changePage(current) { + console.log('当前轮播图序号为:' + current) + }, + clickHandle(item, index) { + console.log(item, index) + } + } + } + ``` + +- 循环播放 + + 默认开启循环播放,可通过 loop 属性配置。 + + ```html + + + ``` + +- 自动播放 + + 默认开启自动播放,可通过 auto-play 属性配置。 + + ```html + + + ``` + +- 自动播放的时间间隔 + + 当开启了自动播放时,还可通过 interval 属性配置时间间隔。 + + ```html + + ``` + +- 切换页面的滑动阈值 + + 可通过`threshold`属性配置切换页面的滑动阈值,既当滑动的距离超过了页面宽度 × `threshold`时,切换页面。默认值为0.3。 + + ```html + + +- 切换页面的速度 + + 默认切换动画耗时为400ms,可通过`speed`属性配置。 + + ```html + + ``` + +### Props 配置 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| - | - | - | - | - | +| loop | 是否循环播放 | Boolean | true/false | true | +| autoPlay | 是否自动播放 | Boolean | true/false | true | +| interval | 播放间隔 | Number | - | 4000 | +| threshold | 切换页面的滑动阈值 | Number | (0, 1) | 0.3 | +| speed | 切换页面的速度 | Number | - | 400 | + +### 事件 + +| 事件名 | 说明 | 参数 | +| - | - | - | +| change | Slide 当前展示项发生改变时触发 | 当前展示项的索引值 | diff --git a/document/components/docs/zh-CN/style.md b/document/components/docs/zh-CN/style.md new file mode 100644 index 000000000..609464b9b --- /dev/null +++ b/document/components/docs/zh-CN/style.md @@ -0,0 +1,172 @@ +## style 模块 + +style 模块主要包含就是样式部分,包含基础的 reset、基础通用样式以及内置 icon。 + +### reset.css + +源码地址:[reset](https://github.com/didi/cube-ui/blob/master/src/common/stylus/reset.styl),使用的就是 Eric Meyer's Reset CSS。 + +```stylus +/** + * Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/) + * http://cssreset.com + */ +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, +menu, nav, output, ruby, section, summary, +time, mark, audio, video, input + margin: 0 + padding: 0 + border: 0 + font-size: 100% + font-weight: normal + vertical-align: baseline + +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, menu, nav, section + display: block + +body + line-height: 1 + +blockquote, q + quotes: none + +blockquote:before, blockquote:after, +q:before, q:after + content: none + +table + border-collapse: collapse + border-spacing: 0 + +/* custom */ + +a + color: #7e8c8d + -webkit-backface-visibility: hidden + text-decoration: none + +li + list-style: none + +body + -webkit-text-size-adjust: none + -webkit-tap-highlight-color: rgba(0, 0, 0, 0) +``` + +### base.css + +源码地址:[base](https://github.com/didi/cube-ui/blob/master/src/common/stylus/base.styl),主要包含的就是 `html`, `body` 元素的 `font-family`, `line-height` 等的设定,修正浮动影响的 `.clear-fix`,以及上下左右四个边框的绝对 1px 边框的 class:`.border-top-1px`, `.border-right-1px`, `.border-bottom-1px`, `.border-left-1px`。 + +```stylus +@import "./variable.styl" + +body, html + line-height: 1 + font-family: 'PingFang SC', 'STHeitiSC-Light', 'Helvetica-Light', arial, sans-serif, 'Droid Sans Fallback' + user-select: none + -webkit-tap-highlight-color: transparent + +.clear-fix + &::after + content: "" + display: table + clear: both + +.border-top-1px, .border-right-1px, .border-bottom-1px, .border-left-1px + position: relative + &::before, &::after + content: "" + display: block + position: absolute + transform-origin: 0 0 + +.border-top-1px + &::before + border-top: 1px solid $color-row-line + left: 0 + top: 0 + width: 100% + transform-origin: 0 top + +.border-right-1px + &::after + border-right: 1px solid $color-col-line + top: 0 + right: 0 + height: 100% + transform-origin: right 0 + +.border-bottom-1px + &::after + border-bottom: 1px solid $color-row-line + left: 0 + bottom: 0 + width: 100% + transform-origin: 0 bottom + +.border-left-1px + &::before + border-left: 1px solid $color-col-line + top: 0 + left: 0 + height: 100% + transform-origin: left 0 + +@media (min-resolution: 2dppx) + .border-top-1px + &::before + width: 200% + transform: scale(.5) translateZ(0) + .border-right-1px + &::after + height: 200% + transform: scale(.5) translateZ(0) + .border-bottom-1px + &::after + width: 200% + transform: scale(.5) translateZ(0) + .border-left-1px + &::before + height: 200% + transform: scale(.5) translateZ(0) + +@media (min-resolution: 3dppx) + .border-top-1px + &::before + width: 300% + transform: scale(.333) translateZ(0) + .border-right-1px + &::after + height: 300% + transform: scale(.333) translateZ(0) + .border-bottom-1px + &::after + width: 300% + transform: scale(.333) translateZ(0) + .border-left-1px + &::before + height: 300% + transform: scale(.333) translateZ(0) +``` + +### 内置 icon + +图标是利用 [font-face](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face) 规则自定义字体 `"cube-icon"` 实现的。 + +内置 icon 有 13 个: + +![cube icons](https://raw.githubusercontent.com/didi/cube-ui/master/assets/icon.png) + +使用的时候只需要加入对应的类名即可,例如 alert 图标,可以这样用:``。 diff --git a/document/components/docs/zh-CN/time-picker.md b/document/components/docs/zh-CN/time-picker.md new file mode 100644 index 000000000..02fcacce0 --- /dev/null +++ b/document/components/docs/zh-CN/time-picker.md @@ -0,0 +1,118 @@ +## TimePicker组件 + +TimePicker 组件提供了常用的日期选择功能。 + +### 示例 + +- 基本用法 + ```html + TimePicker + ``` + + ```js + export default { + methods: { + showTimePicker () { + this.$createTimePicker({ + showNow: true, + minuteStep: 5, + delay: 15 + }).show() + } + } + } + ``` + `showNow` 用于控制是否显示“现在”时间,`minuteStep` 用于控制分钟的步长,`delay` 则表示的是当前时间向后推迟的时间,决定了最小可选时间。 + +- 日期选项配置 + ```html + TimePicker - day options + ``` + + ```js + export default { + methods: { + showTimePicker () { + this.$createTimePicker({ + showNow: true, + minuteStep: 10, + delay: 10, + day: { + len: 5, + filter: ['今天', '明天'], + format: 'M月d日' + }, + onSelect(selectedTime, selectedText) { + console.log(selectedTime, selectedText) + } + }).show() + } + } + } + ``` + `day`字段的`len`属性可以设置第一列需要展示的日期长度; + + `filer`属性设置第一列日期展示的文案; + + `format`属性用以格式化日期显示的方式,当`len`的数量大于`filter`的数组长度时,会以`M月d日`的格式显示文案。 + +- 手动设置时间 + ```html + TimePicker - setTime(next hour) + ``` + + ```js + export default { + methods: { + const time = new Date().valueOf() + 1 * 60 * 60 * 1000 + showTimePicker () { + const timePicker = this.$createTimePicker({ + showNow: true, + minuteStep: 10, + delay: 15, + day: { + len: 5, + filter: ['今天', '明天', '后天'], + format: 'M月d日' + } + }) + + timePicker.setTime(time) + timePicker.show() + } + } + } + ``` + `timePicker`实例向外暴露`setTime`方法用以手动设置时间,时间格式为时间戳。当时间戳小于当前时间戳时,`timePicker`实例会默认显示当前时间。 + +### Props 配置 + +| 参数 | 说明 | 类型 | 默认值 | +| - | - | - | - | +| title | 标题 | String | '选择时间' | +| delay | 将当前时间向后推算的分钟数,决定了最小可选时间 | Number | 15 | +| day | 日期配置 | Object | { len: 3, filter: ['今日'], format: 'M月d日' } | +| showNow | 是否显示当前时间 | Boolean | true | +| minuteStep | 分钟数的步长 | Number | 10 | + +* `day`子配置项 + +| 参数 | 说明 | 类型 | 默认值 | +| - | - | - | - | +| len | 日期列,从当前时间算起,往后推len天 | Number | 3 | +| filter | 日期列,将时间映射为filter中的文案内容 | Array | ['今日'] | +| format | 时间格式化 | String | 'M月d日' | + +### 事件 + +| 事件名 | 说明 | 参数1 | 参数2 | +| - | - | - | - | +| select | 点击确认按钮触发此事件 | selectedTime: 当前选中的timestamp | selectText: 当前选中的时间文案 | +| change | 滑动改变time-picker滚轴时触发此事件 | selectedTime: 当前选中的timestamp | selectText: 当前选中的时间文案 | +| cancel | 点击取消按钮触发此事件 | - | - | + +### 实例方法 + +| 方法名 | 说明 | 参数 | +| - | - | - | +| setTime | 手动设置time-picker组件显示的时间,数据格式为时间戳 | 时间戳 | diff --git a/document/components/docs/zh-CN/tip.md b/document/components/docs/zh-CN/tip.md new file mode 100644 index 000000000..064bcceda --- /dev/null +++ b/document/components/docs/zh-CN/tip.md @@ -0,0 +1,95 @@ +## Tip + +提示,用于弹出提示气泡框。 + +### 示例 + +- 基础使用 + + 通过在 `Tip` 组件上添加 `ref` 属性,获得对于组件的引用,然后调用 `Tip` 组件向外暴露出来的 `show`、`hide` 方法来控制组件的显示或隐藏。 + ```html + Show tip + Tip + ``` + +- 小三角和气泡框的位置 + + 通过 `direction` 属性配置小三角的方向,一般情况下需要通过 `style` 改变气泡框的位置;一般来说,小三角的方向是与气泡框的位置相反的。 + + ```html +

+ cube-ui + +

Awesome!
+ +

+ top + bottom + left + right + ``` + ```javascript + export default { + data() { + return { + direction: '', + tipStyle: '' + } + }, + methods: { + showTip(direction) { + this.direction = direction + this.$refs.tip2.show() + + switch (direction) { + case 'top': + this.tipStyle = 'left: 100px; top: 30px;' + break + case 'bottom': + this.tipStyle = 'left: 100px; top: -50px;' + break + case 'left': + this.tipStyle = 'left: 200px; top: -10px;' + break + case 'right': + this.tipStyle = 'left: 2px; top: -10px;' + break + } + }, + close() { + console.log('click close button') + }, + clickHandler() { + console.log('click tip area') + } + } + } + ``` + +### Props 配置 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| - | - | - | - | - | +| direction | 小三角的方向 | String | top/bottom/left/right | left | +| offsetLeft | 小三角至 Tip 框左边距离 | Number/String | - | 0 | +| offsetTop | 小三角至 Tip 框顶部距离 | Number/String | - | 0 | +| offsetRight | 小三角至 Tip 框右边距离 | Number/String | - | 0 | +| offsetBottom | 小三角至 Tip 框底部距离 | Number/String | - | 0 | + +其中 `offsetLeft`、`offsetTop`、`offsetRight`、`offsetBottom` 的值如果是数字,那么单位就是像素,如果说是字符串,则认为是设置的百分比。 + +### 事件 + +| 参数 | 说明 | 参数 | +| - | - | - | +| close | 点击 Tip 的关闭按钮 | - | +| click | 点击 Tip 的提示内容部分 | - | diff --git a/document/components/docs/zh-CN/toast.md b/document/components/docs/zh-CN/toast.md new file mode 100644 index 000000000..f6614d93a --- /dev/null +++ b/document/components/docs/zh-CN/toast.md @@ -0,0 +1,88 @@ +## Toast + +`Toast`组件主要用于非模态信息提醒,无需用户交互。 + +### 示例 + +- 显示时间设置 + + ```html + Toast - time 1s + Toast - time 0 + ``` + ```js + export default { + methods: { + showToastTime() { + const toast = this.$createToast({ + time: 1000, + txt: 'Toast time 1s' + }) + toast.show() + }, + showToastTime0() { + const toast = this.$createToast({ + time: 0, + txt: 'Toast time 0' + }) + toast.show() + setTimeout(() => { + toast.hide() + }, 2000) + } + } + } + ``` + + `time` 字段决定了 Toast 显示的时间,如果设置为 `0`,则不会消失,需要手动调用组件的 `hide` 方法。 + +- 显示遮罩 + + ```html + Toast- with mask + ``` + ```js + export default { + methods: { + showToastMask () { + const toast = this.$createToast({ + txt: 'Loading...', + mask: true + }) + toast.show() + } + } + } + ``` + + `mask` 设置为 `true` 时会显示遮罩。 + +- 类型设置 + + ```html + Toast - type + ``` + ```js + export default { + methods: { + showToastType() { + const toast = this.$createToast({ + txt: 'Correct', + type: 'correct' + }) + toast.show() + } + } + } + ``` + + `type` 字段决定了 Toast 的显示图标类型,具体对应关系,参见下方的 Props 配置。 + +### Props 配置 + +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| - | - | - | - | - | +| type | 类型(对应不同的 icon) | String | loading/correct/error/warn | loading | +| mask | 遮罩 | Boolean | true/false | false | +| txt | 提示信息 | String | - | '' | +| time | 显示时间 | Number | - | 3000 | diff --git a/document/components/home/en-US.vue b/document/components/home/en-US.vue new file mode 100644 index 000000000..3704da1aa --- /dev/null +++ b/document/components/home/en-US.vue @@ -0,0 +1,17 @@ + + + + diff --git a/document/components/home/home.vue b/document/components/home/home.vue new file mode 100644 index 000000000..bfd544b5b --- /dev/null +++ b/document/components/home/home.vue @@ -0,0 +1,44 @@ + + + + diff --git a/document/components/home/zh-CN.vue b/document/components/home/zh-CN.vue new file mode 100644 index 000000000..30e1140fa --- /dev/null +++ b/document/components/home/zh-CN.vue @@ -0,0 +1,17 @@ + + + + diff --git a/document/components/lang/lang.vue b/document/components/lang/lang.vue new file mode 100644 index 000000000..3f746a29c --- /dev/null +++ b/document/components/lang/lang.vue @@ -0,0 +1,48 @@ + + + + + diff --git a/document/components/side-list/side-list.vue b/document/components/side-list/side-list.vue new file mode 100644 index 000000000..a39c4242d --- /dev/null +++ b/document/components/side-list/side-list.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/document/components/side-nav/side-nav.vue b/document/components/side-nav/side-nav.vue new file mode 100644 index 000000000..9d03fea03 --- /dev/null +++ b/document/components/side-nav/side-nav.vue @@ -0,0 +1,59 @@ + + + + + diff --git a/document/components/viewport/viewport.vue b/document/components/viewport/viewport.vue new file mode 100644 index 000000000..554c53193 --- /dev/null +++ b/document/components/viewport/viewport.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/document/index.html b/document/index.html new file mode 100644 index 000000000..68325eae9 --- /dev/null +++ b/document/index.html @@ -0,0 +1,12 @@ + + + + + + cube-ui Document + + +
+ + + diff --git a/document/main.js b/document/main.js new file mode 100644 index 000000000..94acec8cf --- /dev/null +++ b/document/main.js @@ -0,0 +1,25 @@ +// The Vue build version to load with the `import` command +// (runtime-only or standalone) has been set in webpack.base.conf with an alias. +import 'babel-polyfill' +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import hljs from './common/js/highlight' + +// TODO 需要使用 vConsole 的同学请打开注释即可 +/* eslint-disable no-unused-vars */ +// import vConsole from 'vconsole' + +import './common/stylus/index.styl' +import 'highlight.js/styles/solarized-dark.css' + +hljs.initHighlightingOnLoad() + +import './common/js/directive.js' + +/* eslint-disable no-new */ +new Vue({ + el: '#app', + router, + render: h => h(App) +}) diff --git a/document/router/index.js b/document/router/index.js new file mode 100644 index 000000000..ba06afd6e --- /dev/null +++ b/document/router/index.js @@ -0,0 +1,31 @@ +import Vue from 'vue' +import Router from 'vue-router' +import { getCurrentLang } from '../common/js/utils' +import routes from './routes' +import EnUSHome from '../components/home/en-US.vue' +import ZhCNHome from '../components/home/zh-CN.vue' +// viewport chunk added to main chunk, not in dynamic docs chunks +import '../components/viewport/viewport.vue' + +Vue.use(Router) + +const defaultLang = getCurrentLang() + +export default new Router({ + routes: [ + { + path: '/', + redirect: `/${defaultLang}` + }, + { + path: '/en-US', + component: EnUSHome, + children: routes['en-US'] + }, + { + path: '/zh-CN', + component: ZhCNHome, + children: routes['zh-CN'] + } + ] +}) diff --git a/document/router/routes.js b/document/router/routes.js new file mode 100644 index 000000000..714941440 --- /dev/null +++ b/document/router/routes.js @@ -0,0 +1,38 @@ +import menuConfig from '../common/config/menu' + +const routeMap = {} + +Object.keys(menuConfig).forEach((lang) => { + const docsChildrenRoute = [] + const docsRoute = { + path: 'docs', + redirect: './docs/introduction', + component: () => import(`../components/docs/${lang}.vue`), + children: docsChildrenRoute + } + routeMap[lang] = [docsRoute] + const groups = menuConfig[lang] + Object.keys(groups).forEach((name) => { + getSubList(groups[name]).forEach((key) => { + docsChildrenRoute.push({ + path: key, + component: () => import(`../components/docs/${lang}/${key}.md`) + }) + }) + }) +}) + +export default routeMap + +function getSubList (group) { + let subList = [] + Object.keys(group.subList).forEach((key) => { + const item = group.subList[key] + if (typeof item === 'string') { + subList.push(key) + } else { + subList = subList.concat(getSubList(item)) + } + }) + return subList +} diff --git a/example/App.vue b/example/App.vue new file mode 100644 index 000000000..83a6c0b47 --- /dev/null +++ b/example/App.vue @@ -0,0 +1,147 @@ + + + + + diff --git a/example/components/cube-button-group.vue b/example/components/cube-button-group.vue new file mode 100644 index 000000000..6d16229c8 --- /dev/null +++ b/example/components/cube-button-group.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/example/components/cube-page.vue b/example/components/cube-page.vue new file mode 100644 index 000000000..d110382a0 --- /dev/null +++ b/example/components/cube-page.vue @@ -0,0 +1,85 @@ + + + + + diff --git a/example/components/extend-popup.vue b/example/components/extend-popup.vue new file mode 100644 index 000000000..35f571115 --- /dev/null +++ b/example/components/extend-popup.vue @@ -0,0 +1,34 @@ + + + diff --git a/example/data/area.js b/example/data/area.js new file mode 100644 index 000000000..2464861b2 --- /dev/null +++ b/example/data/area.js @@ -0,0 +1,18218 @@ +export const provinceList = [ + { + text: '北京市', + value: '110000' + }, { + text: '天津市', + value: '120000' + }, { + text: '河北省', + value: '130000' + }, { + text: '山西省', + value: '140000' + }, { + text: '内蒙古自治区', + value: '150000' + }, { + text: '辽宁省', + value: '210000' + }, { + text: '吉林省', + value: '220000' + }, { + text: '黑龙江省', + value: '230000' + }, { + text: '上海市', + value: '310000' + }, { + text: '江苏省', + value: '320000' + }, { + text: '浙江省', + value: '330000' + }, { + text: '安徽省', + value: '340000' + }, { + text: '福建省', + value: '350000' + }, { + text: '江西省', + value: '360000' + }, { + text: '山东省', + value: '370000' + }, { + text: '河南省', + value: '410000' + }, { + text: '湖北省', + value: '420000' + }, { + text: '湖南省', + value: '430000' + }, { + text: '广东省', + value: '440000' + }, { + text: '广西壮族自治区', + value: '450000' + }, { + text: '海南省', + value: '460000' + }, { + text: '重庆市', + value: '500000' + }, { + text: '四川省', + value: '510000' + }, { + text: '贵州省', + value: '520000' + }, { + text: '云南省', + value: '530000' + }, { + text: '西藏自治区', + value: '540000' + }, { + text: '陕西省', + value: '610000' + }, { + text: '甘肃省', + value: '620000' + }, { + text: '青海省', + value: '630000' + }, { + text: '宁夏回族自治区', + value: '640000' + }, { + text: '新疆维吾尔自治区', + value: '650000' + } +] + +export const cityList = { + '110000': [ + { + province: '北京市', + text: '北京市', + value: '110100' + } + ], + '120000': [ + { + province: '天津市', + text: '天津市', + value: '120100' + } + ], + '130000': [ + { + province: '河北省', + text: '石家庄市', + value: '130100' + }, + { + province: '河北省', + text: '唐山市', + value: '130200' + }, + { + province: '河北省', + text: '秦皇岛市', + value: '130300' + }, + { + province: '河北省', + text: '邯郸市', + value: '130400' + }, + { + province: '河北省', + text: '邢台市', + value: '130500' + }, + { + province: '河北省', + text: '保定市', + value: '130600' + }, + { + province: '河北省', + text: '张家口市', + value: '130700' + }, + { + province: '河北省', + text: '承德市', + value: '130800' + }, + { + province: '河北省', + text: '沧州市', + value: '130900' + }, + { + province: '河北省', + text: '廊坊市', + value: '131000' + }, + { + province: '河北省', + text: '衡水市', + value: '131100' + }, + { + province: '河北省', + text: '省直辖县级行政区划', + value: '139000' + } + ], + '140000': [ + { + province: '山西省', + text: '太原市', + value: '140100' + }, + { + province: '山西省', + text: '大同市', + value: '140200' + }, + { + province: '山西省', + text: '阳泉市', + value: '140300' + }, + { + province: '山西省', + text: '长治市', + value: '140400' + }, + { + province: '山西省', + text: '晋城市', + value: '140500' + }, + { + province: '山西省', + text: '朔州市', + value: '140600' + }, + { + province: '山西省', + text: '晋中市', + value: '140700' + }, + { + province: '山西省', + text: '运城市', + value: '140800' + }, + { + province: '山西省', + text: '忻州市', + value: '140900' + }, + { + province: '山西省', + text: '临汾市', + value: '141000' + }, + { + province: '山西省', + text: '吕梁市', + value: '141100' + } + ], + '150000': [ + { + province: '内蒙古自治区', + text: '呼和浩特市', + value: '150100' + }, + { + province: '内蒙古自治区', + text: '包头市', + value: '150200' + }, + { + province: '内蒙古自治区', + text: '乌海市', + value: '150300' + }, + { + province: '内蒙古自治区', + text: '赤峰市', + value: '150400' + }, + { + province: '内蒙古自治区', + text: '通辽市', + value: '150500' + }, + { + province: '内蒙古自治区', + text: '鄂尔多斯市', + value: '150600' + }, + { + province: '内蒙古自治区', + text: '呼伦贝尔市', + value: '150700' + }, + { + province: '内蒙古自治区', + text: '巴彦淖尔市', + value: '150800' + }, + { + province: '内蒙古自治区', + text: '乌兰察布市', + value: '150900' + }, + { + province: '内蒙古自治区', + text: '兴安盟', + value: '152200' + }, + { + province: '内蒙古自治区', + text: '锡林郭勒盟', + value: '152500' + }, + { + province: '内蒙古自治区', + text: '阿拉善盟', + value: '152900' + } + ], + '210000': [ + { + province: '辽宁省', + text: '沈阳市', + value: '210100' + }, + { + province: '辽宁省', + text: '大连市', + value: '210200' + }, + { + province: '辽宁省', + text: '鞍山市', + value: '210300' + }, + { + province: '辽宁省', + text: '抚顺市', + value: '210400' + }, + { + province: '辽宁省', + text: '本溪市', + value: '210500' + }, + { + province: '辽宁省', + text: '丹东市', + value: '210600' + }, + { + province: '辽宁省', + text: '锦州市', + value: '210700' + }, + { + province: '辽宁省', + text: '营口市', + value: '210800' + }, + { + province: '辽宁省', + text: '阜新市', + value: '210900' + }, + { + province: '辽宁省', + text: '辽阳市', + value: '211000' + }, + { + province: '辽宁省', + text: '盘锦市', + value: '211100' + }, + { + province: '辽宁省', + text: '铁岭市', + value: '211200' + }, + { + province: '辽宁省', + text: '朝阳市', + value: '211300' + }, + { + province: '辽宁省', + text: '葫芦岛市', + value: '211400' + } + ], + '220000': [ + { + province: '吉林省', + text: '长春市', + value: '220100' + }, + { + province: '吉林省', + text: '吉林市', + value: '220200' + }, + { + province: '吉林省', + text: '四平市', + value: '220300' + }, + { + province: '吉林省', + text: '辽源市', + value: '220400' + }, + { + province: '吉林省', + text: '通化市', + value: '220500' + }, + { + province: '吉林省', + text: '白山市', + value: '220600' + }, + { + province: '吉林省', + text: '松原市', + value: '220700' + }, + { + province: '吉林省', + text: '白城市', + value: '220800' + }, + { + province: '吉林省', + text: '延边朝鲜族自治州', + value: '222400' + } + ], + '230000': [ + { + province: '黑龙江省', + text: '哈尔滨市', + value: '230100' + }, + { + province: '黑龙江省', + text: '齐齐哈尔市', + value: '230200' + }, + { + province: '黑龙江省', + text: '鸡西市', + value: '230300' + }, + { + province: '黑龙江省', + text: '鹤岗市', + value: '230400' + }, + { + province: '黑龙江省', + text: '双鸭山市', + value: '230500' + }, + { + province: '黑龙江省', + text: '大庆市', + value: '230600' + }, + { + province: '黑龙江省', + text: '伊春市', + value: '230700' + }, + { + province: '黑龙江省', + text: '佳木斯市', + value: '230800' + }, + { + province: '黑龙江省', + text: '七台河市', + value: '230900' + }, + { + province: '黑龙江省', + text: '牡丹江市', + value: '231000' + }, + { + province: '黑龙江省', + text: '黑河市', + value: '231100' + }, + { + province: '黑龙江省', + text: '绥化市', + value: '231200' + }, + { + province: '黑龙江省', + text: '大兴安岭地区', + value: '232700' + } + ], + '310000': [ + { + province: '上海市', + text: '上海市', + value: '310100' + } + ], + '320000': [ + { + province: '江苏省', + text: '南京市', + value: '320100' + }, + { + province: '江苏省', + text: '无锡市', + value: '320200' + }, + { + province: '江苏省', + text: '徐州市', + value: '320300' + }, + { + province: '江苏省', + text: '常州市', + value: '320400' + }, + { + province: '江苏省', + text: '苏州市', + value: '320500' + }, + { + province: '江苏省', + text: '南通市', + value: '320600' + }, + { + province: '江苏省', + text: '连云港市', + value: '320700' + }, + { + province: '江苏省', + text: '淮安市', + value: '320800' + }, + { + province: '江苏省', + text: '盐城市', + value: '320900' + }, + { + province: '江苏省', + text: '扬州市', + value: '321000' + }, + { + province: '江苏省', + text: '镇江市', + value: '321100' + }, + { + province: '江苏省', + text: '泰州市', + value: '321200' + }, + { + province: '江苏省', + text: '宿迁市', + value: '321300' + } + ], + '330000': [ + { + province: '浙江省', + text: '杭州市', + value: '330100' + }, + { + province: '浙江省', + text: '宁波市', + value: '330200' + }, + { + province: '浙江省', + text: '温州市', + value: '330300' + }, + { + province: '浙江省', + text: '嘉兴市', + value: '330400' + }, + { + province: '浙江省', + text: '湖州市', + value: '330500' + }, + { + province: '浙江省', + text: '绍兴市', + value: '330600' + }, + { + province: '浙江省', + text: '金华市', + value: '330700' + }, + { + province: '浙江省', + text: '衢州市', + value: '330800' + }, + { + province: '浙江省', + text: '舟山市', + value: '330900' + }, + { + province: '浙江省', + text: '台州市', + value: '331000' + }, + { + province: '浙江省', + text: '丽水市', + value: '331100' + } + ], + '340000': [ + { + province: '安徽省', + text: '合肥市', + value: '340100' + }, + { + province: '安徽省', + text: '芜湖市', + value: '340200' + }, + { + province: '安徽省', + text: '蚌埠市', + value: '340300' + }, + { + province: '安徽省', + text: '淮南市', + value: '340400' + }, + { + province: '安徽省', + text: '马鞍山市', + value: '340500' + }, + { + province: '安徽省', + text: '淮北市', + value: '340600' + }, + { + province: '安徽省', + text: '铜陵市', + value: '340700' + }, + { + province: '安徽省', + text: '安庆市', + value: '340800' + }, + { + province: '安徽省', + text: '黄山市', + value: '341000' + }, + { + province: '安徽省', + text: '滁州市', + value: '341100' + }, + { + province: '安徽省', + text: '阜阳市', + value: '341200' + }, + { + province: '安徽省', + text: '宿州市', + value: '341300' + }, + { + province: '安徽省', + text: '六安市', + value: '341500' + }, + { + province: '安徽省', + text: '亳州市', + value: '341600' + }, + { + province: '安徽省', + text: '池州市', + value: '341700' + }, + { + province: '安徽省', + text: '宣城市', + value: '341800' + } + ], + '350000': [ + { + province: '福建省', + text: '福州市', + value: '350100' + }, + { + province: '福建省', + text: '厦门市', + value: '350200' + }, + { + province: '福建省', + text: '莆田市', + value: '350300' + }, + { + province: '福建省', + text: '三明市', + value: '350400' + }, + { + province: '福建省', + text: '泉州市', + value: '350500' + }, + { + province: '福建省', + text: '漳州市', + value: '350600' + }, + { + province: '福建省', + text: '南平市', + value: '350700' + }, + { + province: '福建省', + text: '龙岩市', + value: '350800' + }, + { + province: '福建省', + text: '宁德市', + value: '350900' + } + ], + '360000': [ + { + province: '江西省', + text: '南昌市', + value: '360100' + }, + { + province: '江西省', + text: '景德镇市', + value: '360200' + }, + { + province: '江西省', + text: '萍乡市', + value: '360300' + }, + { + province: '江西省', + text: '九江市', + value: '360400' + }, + { + province: '江西省', + text: '新余市', + value: '360500' + }, + { + province: '江西省', + text: '鹰潭市', + value: '360600' + }, + { + province: '江西省', + text: '赣州市', + value: '360700' + }, + { + province: '江西省', + text: '吉安市', + value: '360800' + }, + { + province: '江西省', + text: '宜春市', + value: '360900' + }, + { + province: '江西省', + text: '抚州市', + value: '361000' + }, + { + province: '江西省', + text: '上饶市', + value: '361100' + } + ], + '370000': [ + { + province: '山东省', + text: '济南市', + value: '370100' + }, + { + province: '山东省', + text: '青岛市', + value: '370200' + }, + { + province: '山东省', + text: '淄博市', + value: '370300' + }, + { + province: '山东省', + text: '枣庄市', + value: '370400' + }, + { + province: '山东省', + text: '东营市', + value: '370500' + }, + { + province: '山东省', + text: '烟台市', + value: '370600' + }, + { + province: '山东省', + text: '潍坊市', + value: '370700' + }, + { + province: '山东省', + text: '济宁市', + value: '370800' + }, + { + province: '山东省', + text: '泰安市', + value: '370900' + }, + { + province: '山东省', + text: '威海市', + value: '371000' + }, + { + province: '山东省', + text: '日照市', + value: '371100' + }, + { + province: '山东省', + text: '莱芜市', + value: '371200' + }, + { + province: '山东省', + text: '临沂市', + value: '371300' + }, + { + province: '山东省', + text: '德州市', + value: '371400' + }, + { + province: '山东省', + text: '聊城市', + value: '371500' + }, + { + province: '山东省', + text: '滨州市', + value: '371600' + }, + { + province: '山东省', + text: '菏泽市', + value: '371700' + } + ], + '410000': [ + { + province: '河南省', + text: '郑州市', + value: '410100' + }, + { + province: '河南省', + text: '开封市', + value: '410200' + }, + { + province: '河南省', + text: '洛阳市', + value: '410300' + }, + { + province: '河南省', + text: '平顶山市', + value: '410400' + }, + { + province: '河南省', + text: '安阳市', + value: '410500' + }, + { + province: '河南省', + text: '鹤壁市', + value: '410600' + }, + { + province: '河南省', + text: '新乡市', + value: '410700' + }, + { + province: '河南省', + text: '焦作市', + value: '410800' + }, + { + province: '河南省', + text: '濮阳市', + value: '410900' + }, + { + province: '河南省', + text: '许昌市', + value: '411000' + }, + { + province: '河南省', + text: '漯河市', + value: '411100' + }, + { + province: '河南省', + text: '三门峡市', + value: '411200' + }, + { + province: '河南省', + text: '南阳市', + value: '411300' + }, + { + province: '河南省', + text: '商丘市', + value: '411400' + }, + { + province: '河南省', + text: '信阳市', + value: '411500' + }, + { + province: '河南省', + text: '周口市', + value: '411600' + }, + { + province: '河南省', + text: '驻马店市', + value: '411700' + }, + { + province: '河南省', + text: '省直辖县级行政区划', + value: '419000' + } + ], + '420000': [ + { + province: '湖北省', + text: '武汉市', + value: '420100' + }, + { + province: '湖北省', + text: '黄石市', + value: '420200' + }, + { + province: '湖北省', + text: '十堰市', + value: '420300' + }, + { + province: '湖北省', + text: '宜昌市', + value: '420500' + }, + { + province: '湖北省', + text: '襄阳市', + value: '420600' + }, + { + province: '湖北省', + text: '鄂州市', + value: '420700' + }, + { + province: '湖北省', + text: '荆门市', + value: '420800' + }, + { + province: '湖北省', + text: '孝感市', + value: '420900' + }, + { + province: '湖北省', + text: '荆州市', + value: '421000' + }, + { + province: '湖北省', + text: '黄冈市', + value: '421100' + }, + { + province: '湖北省', + text: '咸宁市', + value: '421200' + }, + { + province: '湖北省', + text: '随州市', + value: '421300' + }, + { + province: '湖北省', + text: '恩施土家族苗族自治州', + value: '422800' + }, + { + province: '湖北省', + text: '省直辖县级行政区划', + value: '429000' + } + ], + '430000': [ + { + province: '湖南省', + text: '长沙市', + value: '430100' + }, + { + province: '湖南省', + text: '株洲市', + value: '430200' + }, + { + province: '湖南省', + text: '湘潭市', + value: '430300' + }, + { + province: '湖南省', + text: '衡阳市', + value: '430400' + }, + { + province: '湖南省', + text: '邵阳市', + value: '430500' + }, + { + province: '湖南省', + text: '岳阳市', + value: '430600' + }, + { + province: '湖南省', + text: '常德市', + value: '430700' + }, + { + province: '湖南省', + text: '张家界市', + value: '430800' + }, + { + province: '湖南省', + text: '益阳市', + value: '430900' + }, + { + province: '湖南省', + text: '郴州市', + value: '431000' + }, + { + province: '湖南省', + text: '永州市', + value: '431100' + }, + { + province: '湖南省', + text: '怀化市', + value: '431200' + }, + { + province: '湖南省', + text: '娄底市', + value: '431300' + }, + { + province: '湖南省', + text: '湘西土家族苗族自治州', + value: '433100' + } + ], + '440000': [ + { + province: '广东省', + text: '广州市', + value: '440100' + }, + { + province: '广东省', + text: '韶关市', + value: '440200' + }, + { + province: '广东省', + text: '深圳市', + value: '440300' + }, + { + province: '广东省', + text: '珠海市', + value: '440400' + }, + { + province: '广东省', + text: '汕头市', + value: '440500' + }, + { + province: '广东省', + text: '佛山市', + value: '440600' + }, + { + province: '广东省', + text: '江门市', + value: '440700' + }, + { + province: '广东省', + text: '湛江市', + value: '440800' + }, + { + province: '广东省', + text: '茂名市', + value: '440900' + }, + { + province: '广东省', + text: '肇庆市', + value: '441200' + }, + { + province: '广东省', + text: '惠州市', + value: '441300' + }, + { + province: '广东省', + text: '梅州市', + value: '441400' + }, + { + province: '广东省', + text: '汕尾市', + value: '441500' + }, + { + province: '广东省', + text: '河源市', + value: '441600' + }, + { + province: '广东省', + text: '阳江市', + value: '441700' + }, + { + province: '广东省', + text: '清远市', + value: '441800' + }, + { + province: '广东省', + text: '东莞市', + value: '441900' + }, + { + province: '广东省', + text: '中山市', + value: '442000' + }, + { + province: '广东省', + text: '潮州市', + value: '445100' + }, + { + province: '广东省', + text: '揭阳市', + value: '445200' + }, + { + province: '广东省', + text: '云浮市', + value: '445300' + } + ], + '450000': [ + { + province: '广西壮族自治区', + text: '南宁市', + value: '450100' + }, + { + province: '广西壮族自治区', + text: '柳州市', + value: '450200' + }, + { + province: '广西壮族自治区', + text: '桂林市', + value: '450300' + }, + { + province: '广西壮族自治区', + text: '梧州市', + value: '450400' + }, + { + province: '广西壮族自治区', + text: '北海市', + value: '450500' + }, + { + province: '广西壮族自治区', + text: '防城港市', + value: '450600' + }, + { + province: '广西壮族自治区', + text: '钦州市', + value: '450700' + }, + { + province: '广西壮族自治区', + text: '贵港市', + value: '450800' + }, + { + province: '广西壮族自治区', + text: '玉林市', + value: '450900' + }, + { + province: '广西壮族自治区', + text: '百色市', + value: '451000' + }, + { + province: '广西壮族自治区', + text: '贺州市', + value: '451100' + }, + { + province: '广西壮族自治区', + text: '河池市', + value: '451200' + }, + { + province: '广西壮族自治区', + text: '来宾市', + value: '451300' + }, + { + province: '广西壮族自治区', + text: '崇左市', + value: '451400' + } + ], + '460000': [ + { + province: '海南省', + text: '海口市', + value: '460100' + }, + { + province: '海南省', + text: '三亚市', + value: '460200' + }, + { + province: '海南省', + text: '三沙市', + value: '460300' + }, + { + province: '海南省', + text: '儋州市', + value: '460400' + }, + { + province: '海南省', + text: '省直辖县级行政区划', + value: '469000' + } + ], + '500000': [ + { + province: '重庆市', + text: '重庆市', + value: '500100' + }, + { + province: '重庆市', + text: '县', + value: '500200' + } + ], + '510000': [ + { + province: '四川省', + text: '成都市', + value: '510100' + }, + { + province: '四川省', + text: '自贡市', + value: '510300' + }, + { + province: '四川省', + text: '攀枝花市', + value: '510400' + }, + { + province: '四川省', + text: '泸州市', + value: '510500' + }, + { + province: '四川省', + text: '德阳市', + value: '510600' + }, + { + province: '四川省', + text: '绵阳市', + value: '510700' + }, + { + province: '四川省', + text: '广元市', + value: '510800' + }, + { + province: '四川省', + text: '遂宁市', + value: '510900' + }, + { + province: '四川省', + text: '内江市', + value: '511000' + }, + { + province: '四川省', + text: '乐山市', + value: '511100' + }, + { + province: '四川省', + text: '南充市', + value: '511300' + }, + { + province: '四川省', + text: '眉山市', + value: '511400' + }, + { + province: '四川省', + text: '宜宾市', + value: '511500' + }, + { + province: '四川省', + text: '广安市', + value: '511600' + }, + { + province: '四川省', + text: '达州市', + value: '511700' + }, + { + province: '四川省', + text: '雅安市', + value: '511800' + }, + { + province: '四川省', + text: '巴中市', + value: '511900' + }, + { + province: '四川省', + text: '资阳市', + value: '512000' + }, + { + province: '四川省', + text: '阿坝藏族羌族自治州', + value: '513200' + }, + { + province: '四川省', + text: '甘孜藏族自治州', + value: '513300' + }, + { + province: '四川省', + text: '凉山彝族自治州', + value: '513400' + } + ], + '520000': [ + { + province: '贵州省', + text: '贵阳市', + value: '520100' + }, + { + province: '贵州省', + text: '六盘水市', + value: '520200' + }, + { + province: '贵州省', + text: '遵义市', + value: '520300' + }, + { + province: '贵州省', + text: '安顺市', + value: '520400' + }, + { + province: '贵州省', + text: '毕节市', + value: '520500' + }, + { + province: '贵州省', + text: '铜仁市', + value: '520600' + }, + { + province: '贵州省', + text: '黔西南布依族苗族自治州', + value: '522300' + }, + { + province: '贵州省', + text: '黔东南苗族侗族自治州', + value: '522600' + }, + { + province: '贵州省', + text: '黔南布依族苗族自治州', + value: '522700' + } + ], + '530000': [ + { + province: '云南省', + text: '昆明市', + value: '530100' + }, + { + province: '云南省', + text: '曲靖市', + value: '530300' + }, + { + province: '云南省', + text: '玉溪市', + value: '530400' + }, + { + province: '云南省', + text: '保山市', + value: '530500' + }, + { + province: '云南省', + text: '昭通市', + value: '530600' + }, + { + province: '云南省', + text: '丽江市', + value: '530700' + }, + { + province: '云南省', + text: '普洱市', + value: '530800' + }, + { + province: '云南省', + text: '临沧市', + value: '530900' + }, + { + province: '云南省', + text: '楚雄彝族自治州', + value: '532300' + }, + { + province: '云南省', + text: '红河哈尼族彝族自治州', + value: '532500' + }, + { + province: '云南省', + text: '文山壮族苗族自治州', + value: '532600' + }, + { + province: '云南省', + text: '西双版纳傣族自治州', + value: '532800' + }, + { + province: '云南省', + text: '大理白族自治州', + value: '532900' + }, + { + province: '云南省', + text: '德宏傣族景颇族自治州', + value: '533100' + }, + { + province: '云南省', + text: '怒江傈僳族自治州', + value: '533300' + }, + { + province: '云南省', + text: '迪庆藏族自治州', + value: '533400' + } + ], + '540000': [ + { + province: '西藏自治区', + text: '拉萨市', + value: '540100' + }, + { + province: '西藏自治区', + text: '日喀则市', + value: '540200' + }, + { + province: '西藏自治区', + text: '昌都市', + value: '540300' + }, + { + province: '西藏自治区', + text: '林芝市', + value: '540400' + }, + { + province: '西藏自治区', + text: '山南市', + value: '540500' + }, + { + province: '西藏自治区', + text: '那曲地区', + value: '542400' + }, + { + province: '西藏自治区', + text: '阿里地区', + value: '542500' + } + ], + '610000': [ + { + province: '陕西省', + text: '西安市', + value: '610100' + }, + { + province: '陕西省', + text: '铜川市', + value: '610200' + }, + { + province: '陕西省', + text: '宝鸡市', + value: '610300' + }, + { + province: '陕西省', + text: '咸阳市', + value: '610400' + }, + { + province: '陕西省', + text: '渭南市', + value: '610500' + }, + { + province: '陕西省', + text: '延安市', + value: '610600' + }, + { + province: '陕西省', + text: '汉中市', + value: '610700' + }, + { + province: '陕西省', + text: '榆林市', + value: '610800' + }, + { + province: '陕西省', + text: '安康市', + value: '610900' + }, + { + province: '陕西省', + text: '商洛市', + value: '611000' + } + ], + '620000': [ + { + province: '甘肃省', + text: '兰州市', + value: '620100' + }, + { + province: '甘肃省', + text: '嘉峪关市', + value: '620200' + }, + { + province: '甘肃省', + text: '金昌市', + value: '620300' + }, + { + province: '甘肃省', + text: '白银市', + value: '620400' + }, + { + province: '甘肃省', + text: '天水市', + value: '620500' + }, + { + province: '甘肃省', + text: '武威市', + value: '620600' + }, + { + province: '甘肃省', + text: '张掖市', + value: '620700' + }, + { + province: '甘肃省', + text: '平凉市', + value: '620800' + }, + { + province: '甘肃省', + text: '酒泉市', + value: '620900' + }, + { + province: '甘肃省', + text: '庆阳市', + value: '621000' + }, + { + province: '甘肃省', + text: '定西市', + value: '621100' + }, + { + province: '甘肃省', + text: '陇南市', + value: '621200' + }, + { + province: '甘肃省', + text: '临夏回族自治州', + value: '622900' + }, + { + province: '甘肃省', + text: '甘南藏族自治州', + value: '623000' + } + ], + '630000': [ + { + province: '青海省', + text: '西宁市', + value: '630100' + }, + { + province: '青海省', + text: '海东市', + value: '630200' + }, + { + province: '青海省', + text: '海北藏族自治州', + value: '632200' + }, + { + province: '青海省', + text: '黄南藏族自治州', + value: '632300' + }, + { + province: '青海省', + text: '海南藏族自治州', + value: '632500' + }, + { + province: '青海省', + text: '果洛藏族自治州', + value: '632600' + }, + { + province: '青海省', + text: '玉树藏族自治州', + value: '632700' + }, + { + province: '青海省', + text: '海西蒙古族藏族自治州', + value: '632800' + } + ], + '640000': [ + { + province: '宁夏回族自治区', + text: '银川市', + value: '640100' + }, + { + province: '宁夏回族自治区', + text: '石嘴山市', + value: '640200' + }, + { + province: '宁夏回族自治区', + text: '吴忠市', + value: '640300' + }, + { + province: '宁夏回族自治区', + text: '固原市', + value: '640400' + }, + { + province: '宁夏回族自治区', + text: '中卫市', + value: '640500' + } + ], + '650000': [ + { + province: '新疆维吾尔自治区', + text: '乌鲁木齐市', + value: '650100' + }, + { + province: '新疆维吾尔自治区', + text: '克拉玛依市', + value: '650200' + }, + { + province: '新疆维吾尔自治区', + text: '吐鲁番市', + value: '650400' + }, + { + province: '新疆维吾尔自治区', + text: '哈密市', + value: '650500' + }, + { + province: '新疆维吾尔自治区', + text: '昌吉回族自治州', + value: '652300' + }, + { + province: '新疆维吾尔自治区', + text: '博尔塔拉蒙古自治州', + value: '652700' + }, + { + province: '新疆维吾尔自治区', + text: '巴音郭楞蒙古自治州', + value: '652800' + }, + { + province: '新疆维吾尔自治区', + text: '阿克苏地区', + value: '652900' + }, + { + province: '新疆维吾尔自治区', + text: '克孜勒苏柯尔克孜自治州', + value: '653000' + }, + { + province: '新疆维吾尔自治区', + text: '喀什地区', + value: '653100' + }, + { + province: '新疆维吾尔自治区', + text: '和田地区', + value: '653200' + }, + { + province: '新疆维吾尔自治区', + text: '伊犁哈萨克自治州', + value: '654000' + }, + { + province: '新疆维吾尔自治区', + text: '塔城地区', + value: '654200' + }, + { + province: '新疆维吾尔自治区', + text: '阿勒泰地区', + value: '654300' + }, + { + province: '新疆维吾尔自治区', + text: '自治区直辖县级行政区划', + value: '659000' + } + ] +} + +export const areaList = { + '110100': [ + { + city: '市辖区', + text: '东城区', + value: '110101' + }, + { + city: '市辖区', + text: '西城区', + value: '110102' + }, + { + city: '市辖区', + text: '朝阳区', + value: '110105' + }, + { + city: '市辖区', + text: '丰台区', + value: '110106' + }, + { + city: '市辖区', + text: '石景山区', + value: '110107' + }, + { + city: '市辖区', + text: '海淀区', + value: '110108' + }, + { + city: '市辖区', + text: '门头沟区', + value: '110109' + }, + { + city: '市辖区', + text: '房山区', + value: '110111' + }, + { + city: '市辖区', + text: '通州区', + value: '110112' + }, + { + city: '市辖区', + text: '顺义区', + value: '110113' + }, + { + city: '市辖区', + text: '昌平区', + value: '110114' + }, + { + city: '市辖区', + text: '大兴区', + value: '110115' + }, + { + city: '市辖区', + text: '怀柔区', + value: '110116' + }, + { + city: '市辖区', + text: '平谷区', + value: '110117' + }, + { + city: '市辖区', + text: '密云区', + value: '110118' + }, + { + city: '市辖区', + text: '延庆区', + value: '110119' + } + ], + '120100': [ + { + city: '市辖区', + text: '和平区', + value: '120101' + }, + { + city: '市辖区', + text: '河东区', + value: '120102' + }, + { + city: '市辖区', + text: '河西区', + value: '120103' + }, + { + city: '市辖区', + text: '南开区', + value: '120104' + }, + { + city: '市辖区', + text: '河北区', + value: '120105' + }, + { + city: '市辖区', + text: '红桥区', + value: '120106' + }, + { + city: '市辖区', + text: '东丽区', + value: '120110' + }, + { + city: '市辖区', + text: '西青区', + value: '120111' + }, + { + city: '市辖区', + text: '津南区', + value: '120112' + }, + { + city: '市辖区', + text: '北辰区', + value: '120113' + }, + { + city: '市辖区', + text: '武清区', + value: '120114' + }, + { + city: '市辖区', + text: '宝坻区', + value: '120115' + }, + { + city: '市辖区', + text: '滨海新区', + value: '120116' + }, + { + city: '市辖区', + text: '宁河区', + value: '120117' + }, + { + city: '市辖区', + text: '静海区', + value: '120118' + }, + { + city: '市辖区', + text: '蓟州区', + value: '120119' + } + ], + '130100': [ + { + city: '石家庄市', + text: '市辖区', + value: '130101' + }, + { + city: '石家庄市', + text: '长安区', + value: '130102' + }, + { + city: '石家庄市', + text: '桥西区', + value: '130104' + }, + { + city: '石家庄市', + text: '新华区', + value: '130105' + }, + { + city: '石家庄市', + text: '井陉矿区', + value: '130107' + }, + { + city: '石家庄市', + text: '裕华区', + value: '130108' + }, + { + city: '石家庄市', + text: '藁城区', + value: '130109' + }, + { + city: '石家庄市', + text: '鹿泉区', + value: '130110' + }, + { + city: '石家庄市', + text: '栾城区', + value: '130111' + }, + { + city: '石家庄市', + text: '井陉县', + value: '130121' + }, + { + city: '石家庄市', + text: '正定县', + value: '130123' + }, + { + city: '石家庄市', + text: '行唐县', + value: '130125' + }, + { + city: '石家庄市', + text: '灵寿县', + value: '130126' + }, + { + city: '石家庄市', + text: '高邑县', + value: '130127' + }, + { + city: '石家庄市', + text: '深泽县', + value: '130128' + }, + { + city: '石家庄市', + text: '赞皇县', + value: '130129' + }, + { + city: '石家庄市', + text: '无极县', + value: '130130' + }, + { + city: '石家庄市', + text: '平山县', + value: '130131' + }, + { + city: '石家庄市', + text: '元氏县', + value: '130132' + }, + { + city: '石家庄市', + text: '赵县', + value: '130133' + }, + { + city: '石家庄市', + text: '晋州市', + value: '130183' + }, + { + city: '石家庄市', + text: '新乐市', + value: '130184' + } + ], + '130200': [ + { + city: '唐山市', + text: '市辖区', + value: '130201' + }, + { + city: '唐山市', + text: '路南区', + value: '130202' + }, + { + city: '唐山市', + text: '路北区', + value: '130203' + }, + { + city: '唐山市', + text: '古冶区', + value: '130204' + }, + { + city: '唐山市', + text: '开平区', + value: '130205' + }, + { + city: '唐山市', + text: '丰南区', + value: '130207' + }, + { + city: '唐山市', + text: '丰润区', + value: '130208' + }, + { + city: '唐山市', + text: '曹妃甸区', + value: '130209' + }, + { + city: '唐山市', + text: '滦县', + value: '130223' + }, + { + city: '唐山市', + text: '滦南县', + value: '130224' + }, + { + city: '唐山市', + text: '乐亭县', + value: '130225' + }, + { + city: '唐山市', + text: '迁西县', + value: '130227' + }, + { + city: '唐山市', + text: '玉田县', + value: '130229' + }, + { + city: '唐山市', + text: '遵化市', + value: '130281' + }, + { + city: '唐山市', + text: '迁安市', + value: '130283' + } + ], + '130300': [ + { + city: '秦皇岛市', + text: '市辖区', + value: '130301' + }, + { + city: '秦皇岛市', + text: '海港区', + value: '130302' + }, + { + city: '秦皇岛市', + text: '山海关区', + value: '130303' + }, + { + city: '秦皇岛市', + text: '北戴河区', + value: '130304' + }, + { + city: '秦皇岛市', + text: '抚宁区', + value: '130306' + }, + { + city: '秦皇岛市', + text: '青龙满族自治县', + value: '130321' + }, + { + city: '秦皇岛市', + text: '昌黎县', + value: '130322' + }, + { + city: '秦皇岛市', + text: '卢龙县', + value: '130324' + } + ], + '130400': [ + { + city: '邯郸市', + text: '市辖区', + value: '130401' + }, + { + city: '邯郸市', + text: '邯山区', + value: '130402' + }, + { + city: '邯郸市', + text: '丛台区', + value: '130403' + }, + { + city: '邯郸市', + text: '复兴区', + value: '130404' + }, + { + city: '邯郸市', + text: '峰峰矿区', + value: '130406' + }, + { + city: '邯郸市', + text: '邯郸县', + value: '130421' + }, + { + city: '邯郸市', + text: '临漳县', + value: '130423' + }, + { + city: '邯郸市', + text: '成安县', + value: '130424' + }, + { + city: '邯郸市', + text: '大名县', + value: '130425' + }, + { + city: '邯郸市', + text: '涉县', + value: '130426' + }, + { + city: '邯郸市', + text: '磁县', + value: '130427' + }, + { + city: '邯郸市', + text: '肥乡县', + value: '130428' + }, + { + city: '邯郸市', + text: '永年县', + value: '130429' + }, + { + city: '邯郸市', + text: '邱县', + value: '130430' + }, + { + city: '邯郸市', + text: '鸡泽县', + value: '130431' + }, + { + city: '邯郸市', + text: '广平县', + value: '130432' + }, + { + city: '邯郸市', + text: '馆陶县', + value: '130433' + }, + { + city: '邯郸市', + text: '魏县', + value: '130434' + }, + { + city: '邯郸市', + text: '曲周县', + value: '130435' + }, + { + city: '邯郸市', + text: '武安市', + value: '130481' + } + ], + '130500': [ + { + city: '邢台市', + text: '市辖区', + value: '130501' + }, + { + city: '邢台市', + text: '桥东区', + value: '130502' + }, + { + city: '邢台市', + text: '桥西区', + value: '130503' + }, + { + city: '邢台市', + text: '邢台县', + value: '130521' + }, + { + city: '邢台市', + text: '临城县', + value: '130522' + }, + { + city: '邢台市', + text: '内丘县', + value: '130523' + }, + { + city: '邢台市', + text: '柏乡县', + value: '130524' + }, + { + city: '邢台市', + text: '隆尧县', + value: '130525' + }, + { + city: '邢台市', + text: '任县', + value: '130526' + }, + { + city: '邢台市', + text: '南和县', + value: '130527' + }, + { + city: '邢台市', + text: '宁晋县', + value: '130528' + }, + { + city: '邢台市', + text: '巨鹿县', + value: '130529' + }, + { + city: '邢台市', + text: '新河县', + value: '130530' + }, + { + city: '邢台市', + text: '广宗县', + value: '130531' + }, + { + city: '邢台市', + text: '平乡县', + value: '130532' + }, + { + city: '邢台市', + text: '威县', + value: '130533' + }, + { + city: '邢台市', + text: '清河县', + value: '130534' + }, + { + city: '邢台市', + text: '临西县', + value: '130535' + }, + { + city: '邢台市', + text: '南宫市', + value: '130581' + }, + { + city: '邢台市', + text: '沙河市', + value: '130582' + } + ], + '130600': [ + { + city: '保定市', + text: '市辖区', + value: '130601' + }, + { + city: '保定市', + text: '竞秀区', + value: '130602' + }, + { + city: '保定市', + text: '莲池区', + value: '130606' + }, + { + city: '保定市', + text: '满城区', + value: '130607' + }, + { + city: '保定市', + text: '清苑区', + value: '130608' + }, + { + city: '保定市', + text: '徐水区', + value: '130609' + }, + { + city: '保定市', + text: '涞水县', + value: '130623' + }, + { + city: '保定市', + text: '阜平县', + value: '130624' + }, + { + city: '保定市', + text: '定兴县', + value: '130626' + }, + { + city: '保定市', + text: '唐县', + value: '130627' + }, + { + city: '保定市', + text: '高阳县', + value: '130628' + }, + { + city: '保定市', + text: '容城县', + value: '130629' + }, + { + city: '保定市', + text: '涞源县', + value: '130630' + }, + { + city: '保定市', + text: '望都县', + value: '130631' + }, + { + city: '保定市', + text: '安新县', + value: '130632' + }, + { + city: '保定市', + text: '易县', + value: '130633' + }, + { + city: '保定市', + text: '曲阳县', + value: '130634' + }, + { + city: '保定市', + text: '蠡县', + value: '130635' + }, + { + city: '保定市', + text: '顺平县', + value: '130636' + }, + { + city: '保定市', + text: '博野县', + value: '130637' + }, + { + city: '保定市', + text: '雄县', + value: '130638' + }, + { + city: '保定市', + text: '涿州市', + value: '130681' + }, + { + city: '保定市', + text: '安国市', + value: '130683' + }, + { + city: '保定市', + text: '高碑店市', + value: '130684' + } + ], + '130700': [ + { + city: '张家口市', + text: '市辖区', + value: '130701' + }, + { + city: '张家口市', + text: '桥东区', + value: '130702' + }, + { + city: '张家口市', + text: '桥西区', + value: '130703' + }, + { + city: '张家口市', + text: '宣化区', + value: '130705' + }, + { + city: '张家口市', + text: '下花园区', + value: '130706' + }, + { + city: '张家口市', + text: '万全区', + value: '130708' + }, + { + city: '张家口市', + text: '崇礼区', + value: '130709' + }, + { + city: '张家口市', + text: '张北县', + value: '130722' + }, + { + city: '张家口市', + text: '康保县', + value: '130723' + }, + { + city: '张家口市', + text: '沽源县', + value: '130724' + }, + { + city: '张家口市', + text: '尚义县', + value: '130725' + }, + { + city: '张家口市', + text: '蔚县', + value: '130726' + }, + { + city: '张家口市', + text: '阳原县', + value: '130727' + }, + { + city: '张家口市', + text: '怀安县', + value: '130728' + }, + { + city: '张家口市', + text: '怀来县', + value: '130730' + }, + { + city: '张家口市', + text: '涿鹿县', + value: '130731' + }, + { + city: '张家口市', + text: '赤城县', + value: '130732' + } + ], + '130800': [ + { + city: '承德市', + text: '市辖区', + value: '130801' + }, + { + city: '承德市', + text: '双桥区', + value: '130802' + }, + { + city: '承德市', + text: '双滦区', + value: '130803' + }, + { + city: '承德市', + text: '鹰手营子矿区', + value: '130804' + }, + { + city: '承德市', + text: '承德县', + value: '130821' + }, + { + city: '承德市', + text: '兴隆县', + value: '130822' + }, + { + city: '承德市', + text: '平泉县', + value: '130823' + }, + { + city: '承德市', + text: '滦平县', + value: '130824' + }, + { + city: '承德市', + text: '隆化县', + value: '130825' + }, + { + city: '承德市', + text: '丰宁满族自治县', + value: '130826' + }, + { + city: '承德市', + text: '宽城满族自治县', + value: '130827' + }, + { + city: '承德市', + text: '围场满族蒙古族自治县', + value: '130828' + } + ], + '130900': [ + { + city: '沧州市', + text: '市辖区', + value: '130901' + }, + { + city: '沧州市', + text: '新华区', + value: '130902' + }, + { + city: '沧州市', + text: '运河区', + value: '130903' + }, + { + city: '沧州市', + text: '沧县', + value: '130921' + }, + { + city: '沧州市', + text: '青县', + value: '130922' + }, + { + city: '沧州市', + text: '东光县', + value: '130923' + }, + { + city: '沧州市', + text: '海兴县', + value: '130924' + }, + { + city: '沧州市', + text: '盐山县', + value: '130925' + }, + { + city: '沧州市', + text: '肃宁县', + value: '130926' + }, + { + city: '沧州市', + text: '南皮县', + value: '130927' + }, + { + city: '沧州市', + text: '吴桥县', + value: '130928' + }, + { + city: '沧州市', + text: '献县', + value: '130929' + }, + { + city: '沧州市', + text: '孟村回族自治县', + value: '130930' + }, + { + city: '沧州市', + text: '泊头市', + value: '130981' + }, + { + city: '沧州市', + text: '任丘市', + value: '130982' + }, + { + city: '沧州市', + text: '黄骅市', + value: '130983' + }, + { + city: '沧州市', + text: '河间市', + value: '130984' + } + ], + '131000': [ + { + city: '廊坊市', + text: '市辖区', + value: '131001' + }, + { + city: '廊坊市', + text: '安次区', + value: '131002' + }, + { + city: '廊坊市', + text: '广阳区', + value: '131003' + }, + { + city: '廊坊市', + text: '固安县', + value: '131022' + }, + { + city: '廊坊市', + text: '永清县', + value: '131023' + }, + { + city: '廊坊市', + text: '香河县', + value: '131024' + }, + { + city: '廊坊市', + text: '大城县', + value: '131025' + }, + { + city: '廊坊市', + text: '文安县', + value: '131026' + }, + { + city: '廊坊市', + text: '大厂回族自治县', + value: '131028' + }, + { + city: '廊坊市', + text: '霸州市', + value: '131081' + }, + { + city: '廊坊市', + text: '三河市', + value: '131082' + } + ], + '131100': [ + { + city: '衡水市', + text: '市辖区', + value: '131101' + }, + { + city: '衡水市', + text: '桃城区', + value: '131102' + }, + { + city: '衡水市', + text: '冀州区', + value: '131103' + }, + { + city: '衡水市', + text: '枣强县', + value: '131121' + }, + { + city: '衡水市', + text: '武邑县', + value: '131122' + }, + { + city: '衡水市', + text: '武强县', + value: '131123' + }, + { + city: '衡水市', + text: '饶阳县', + value: '131124' + }, + { + city: '衡水市', + text: '安平县', + value: '131125' + }, + { + city: '衡水市', + text: '故城县', + value: '131126' + }, + { + city: '衡水市', + text: '景县', + value: '131127' + }, + { + city: '衡水市', + text: '阜城县', + value: '131128' + }, + { + city: '衡水市', + text: '深州市', + value: '131182' + } + ], + '139000': [ + { + city: '省直辖县级行政区划', + text: '定州市', + value: '139001' + }, + { + city: '省直辖县级行政区划', + text: '辛集市', + value: '139002' + } + ], + '140100': [ + { + city: '太原市', + text: '市辖区', + value: '140101' + }, + { + city: '太原市', + text: '小店区', + value: '140105' + }, + { + city: '太原市', + text: '迎泽区', + value: '140106' + }, + { + city: '太原市', + text: '杏花岭区', + value: '140107' + }, + { + city: '太原市', + text: '尖草坪区', + value: '140108' + }, + { + city: '太原市', + text: '万柏林区', + value: '140109' + }, + { + city: '太原市', + text: '晋源区', + value: '140110' + }, + { + city: '太原市', + text: '清徐县', + value: '140121' + }, + { + city: '太原市', + text: '阳曲县', + value: '140122' + }, + { + city: '太原市', + text: '娄烦县', + value: '140123' + }, + { + city: '太原市', + text: '古交市', + value: '140181' + } + ], + '140200': [ + { + city: '大同市', + text: '市辖区', + value: '140201' + }, + { + city: '大同市', + text: '城区', + value: '140202' + }, + { + city: '大同市', + text: '矿区', + value: '140203' + }, + { + city: '大同市', + text: '南郊区', + value: '140211' + }, + { + city: '大同市', + text: '新荣区', + value: '140212' + }, + { + city: '大同市', + text: '阳高县', + value: '140221' + }, + { + city: '大同市', + text: '天镇县', + value: '140222' + }, + { + city: '大同市', + text: '广灵县', + value: '140223' + }, + { + city: '大同市', + text: '灵丘县', + value: '140224' + }, + { + city: '大同市', + text: '浑源县', + value: '140225' + }, + { + city: '大同市', + text: '左云县', + value: '140226' + }, + { + city: '大同市', + text: '大同县', + value: '140227' + } + ], + '140300': [ + { + city: '阳泉市', + text: '市辖区', + value: '140301' + }, + { + city: '阳泉市', + text: '城区', + value: '140302' + }, + { + city: '阳泉市', + text: '矿区', + value: '140303' + }, + { + city: '阳泉市', + text: '郊区', + value: '140311' + }, + { + city: '阳泉市', + text: '平定县', + value: '140321' + }, + { + city: '阳泉市', + text: '盂县', + value: '140322' + } + ], + '140400': [ + { + city: '长治市', + text: '市辖区', + value: '140401' + }, + { + city: '长治市', + text: '城区', + value: '140402' + }, + { + city: '长治市', + text: '郊区', + value: '140411' + }, + { + city: '长治市', + text: '长治县', + value: '140421' + }, + { + city: '长治市', + text: '襄垣县', + value: '140423' + }, + { + city: '长治市', + text: '屯留县', + value: '140424' + }, + { + city: '长治市', + text: '平顺县', + value: '140425' + }, + { + city: '长治市', + text: '黎城县', + value: '140426' + }, + { + city: '长治市', + text: '壶关县', + value: '140427' + }, + { + city: '长治市', + text: '长子县', + value: '140428' + }, + { + city: '长治市', + text: '武乡县', + value: '140429' + }, + { + city: '长治市', + text: '沁县', + value: '140430' + }, + { + city: '长治市', + text: '沁源县', + value: '140431' + }, + { + city: '长治市', + text: '潞城市', + value: '140481' + } + ], + '140500': [ + { + city: '晋城市', + text: '市辖区', + value: '140501' + }, + { + city: '晋城市', + text: '城区', + value: '140502' + }, + { + city: '晋城市', + text: '沁水县', + value: '140521' + }, + { + city: '晋城市', + text: '阳城县', + value: '140522' + }, + { + city: '晋城市', + text: '陵川县', + value: '140524' + }, + { + city: '晋城市', + text: '泽州县', + value: '140525' + }, + { + city: '晋城市', + text: '高平市', + value: '140581' + } + ], + '140600': [ + { + city: '朔州市', + text: '市辖区', + value: '140601' + }, + { + city: '朔州市', + text: '朔城区', + value: '140602' + }, + { + city: '朔州市', + text: '平鲁区', + value: '140603' + }, + { + city: '朔州市', + text: '山阴县', + value: '140621' + }, + { + city: '朔州市', + text: '应县', + value: '140622' + }, + { + city: '朔州市', + text: '右玉县', + value: '140623' + }, + { + city: '朔州市', + text: '怀仁县', + value: '140624' + } + ], + '140700': [ + { + city: '晋中市', + text: '市辖区', + value: '140701' + }, + { + city: '晋中市', + text: '榆次区', + value: '140702' + }, + { + city: '晋中市', + text: '榆社县', + value: '140721' + }, + { + city: '晋中市', + text: '左权县', + value: '140722' + }, + { + city: '晋中市', + text: '和顺县', + value: '140723' + }, + { + city: '晋中市', + text: '昔阳县', + value: '140724' + }, + { + city: '晋中市', + text: '寿阳县', + value: '140725' + }, + { + city: '晋中市', + text: '太谷县', + value: '140726' + }, + { + city: '晋中市', + text: '祁县', + value: '140727' + }, + { + city: '晋中市', + text: '平遥县', + value: '140728' + }, + { + city: '晋中市', + text: '灵石县', + value: '140729' + }, + { + city: '晋中市', + text: '介休市', + value: '140781' + } + ], + '140800': [ + { + city: '运城市', + text: '市辖区', + value: '140801' + }, + { + city: '运城市', + text: '盐湖区', + value: '140802' + }, + { + city: '运城市', + text: '临猗县', + value: '140821' + }, + { + city: '运城市', + text: '万荣县', + value: '140822' + }, + { + city: '运城市', + text: '闻喜县', + value: '140823' + }, + { + city: '运城市', + text: '稷山县', + value: '140824' + }, + { + city: '运城市', + text: '新绛县', + value: '140825' + }, + { + city: '运城市', + text: '绛县', + value: '140826' + }, + { + city: '运城市', + text: '垣曲县', + value: '140827' + }, + { + city: '运城市', + text: '夏县', + value: '140828' + }, + { + city: '运城市', + text: '平陆县', + value: '140829' + }, + { + city: '运城市', + text: '芮城县', + value: '140830' + }, + { + city: '运城市', + text: '永济市', + value: '140881' + }, + { + city: '运城市', + text: '河津市', + value: '140882' + } + ], + '140900': [ + { + city: '忻州市', + text: '市辖区', + value: '140901' + }, + { + city: '忻州市', + text: '忻府区', + value: '140902' + }, + { + city: '忻州市', + text: '定襄县', + value: '140921' + }, + { + city: '忻州市', + text: '五台县', + value: '140922' + }, + { + city: '忻州市', + text: '代县', + value: '140923' + }, + { + city: '忻州市', + text: '繁峙县', + value: '140924' + }, + { + city: '忻州市', + text: '宁武县', + value: '140925' + }, + { + city: '忻州市', + text: '静乐县', + value: '140926' + }, + { + city: '忻州市', + text: '神池县', + value: '140927' + }, + { + city: '忻州市', + text: '五寨县', + value: '140928' + }, + { + city: '忻州市', + text: '岢岚县', + value: '140929' + }, + { + city: '忻州市', + text: '河曲县', + value: '140930' + }, + { + city: '忻州市', + text: '保德县', + value: '140931' + }, + { + city: '忻州市', + text: '偏关县', + value: '140932' + }, + { + city: '忻州市', + text: '原平市', + value: '140981' + } + ], + '141000': [ + { + city: '临汾市', + text: '市辖区', + value: '141001' + }, + { + city: '临汾市', + text: '尧都区', + value: '141002' + }, + { + city: '临汾市', + text: '曲沃县', + value: '141021' + }, + { + city: '临汾市', + text: '翼城县', + value: '141022' + }, + { + city: '临汾市', + text: '襄汾县', + value: '141023' + }, + { + city: '临汾市', + text: '洪洞县', + value: '141024' + }, + { + city: '临汾市', + text: '古县', + value: '141025' + }, + { + city: '临汾市', + text: '安泽县', + value: '141026' + }, + { + city: '临汾市', + text: '浮山县', + value: '141027' + }, + { + city: '临汾市', + text: '吉县', + value: '141028' + }, + { + city: '临汾市', + text: '乡宁县', + value: '141029' + }, + { + city: '临汾市', + text: '大宁县', + value: '141030' + }, + { + city: '临汾市', + text: '隰县', + value: '141031' + }, + { + city: '临汾市', + text: '永和县', + value: '141032' + }, + { + city: '临汾市', + text: '蒲县', + value: '141033' + }, + { + city: '临汾市', + text: '汾西县', + value: '141034' + }, + { + city: '临汾市', + text: '侯马市', + value: '141081' + }, + { + city: '临汾市', + text: '霍州市', + value: '141082' + } + ], + '141100': [ + { + city: '吕梁市', + text: '市辖区', + value: '141101' + }, + { + city: '吕梁市', + text: '离石区', + value: '141102' + }, + { + city: '吕梁市', + text: '文水县', + value: '141121' + }, + { + city: '吕梁市', + text: '交城县', + value: '141122' + }, + { + city: '吕梁市', + text: '兴县', + value: '141123' + }, + { + city: '吕梁市', + text: '临县', + value: '141124' + }, + { + city: '吕梁市', + text: '柳林县', + value: '141125' + }, + { + city: '吕梁市', + text: '石楼县', + value: '141126' + }, + { + city: '吕梁市', + text: '岚县', + value: '141127' + }, + { + city: '吕梁市', + text: '方山县', + value: '141128' + }, + { + city: '吕梁市', + text: '中阳县', + value: '141129' + }, + { + city: '吕梁市', + text: '交口县', + value: '141130' + }, + { + city: '吕梁市', + text: '孝义市', + value: '141181' + }, + { + city: '吕梁市', + text: '汾阳市', + value: '141182' + } + ], + '150100': [ + { + city: '呼和浩特市', + text: '市辖区', + value: '150101' + }, + { + city: '呼和浩特市', + text: '新城区', + value: '150102' + }, + { + city: '呼和浩特市', + text: '回民区', + value: '150103' + }, + { + city: '呼和浩特市', + text: '玉泉区', + value: '150104' + }, + { + city: '呼和浩特市', + text: '赛罕区', + value: '150105' + }, + { + city: '呼和浩特市', + text: '土默特左旗', + value: '150121' + }, + { + city: '呼和浩特市', + text: '托克托县', + value: '150122' + }, + { + city: '呼和浩特市', + text: '和林格尔县', + value: '150123' + }, + { + city: '呼和浩特市', + text: '清水河县', + value: '150124' + }, + { + city: '呼和浩特市', + text: '武川县', + value: '150125' + } + ], + '150200': [ + { + city: '包头市', + text: '市辖区', + value: '150201' + }, + { + city: '包头市', + text: '东河区', + value: '150202' + }, + { + city: '包头市', + text: '昆都仑区', + value: '150203' + }, + { + city: '包头市', + text: '青山区', + value: '150204' + }, + { + city: '包头市', + text: '石拐区', + value: '150205' + }, + { + city: '包头市', + text: '白云鄂博矿区', + value: '150206' + }, + { + city: '包头市', + text: '九原区', + value: '150207' + }, + { + city: '包头市', + text: '土默特右旗', + value: '150221' + }, + { + city: '包头市', + text: '固阳县', + value: '150222' + }, + { + city: '包头市', + text: '达尔罕茂明安联合旗', + value: '150223' + } + ], + '150300': [ + { + city: '乌海市', + text: '市辖区', + value: '150301' + }, + { + city: '乌海市', + text: '海勃湾区', + value: '150302' + }, + { + city: '乌海市', + text: '海南区', + value: '150303' + }, + { + city: '乌海市', + text: '乌达区', + value: '150304' + } + ], + '150400': [ + { + city: '赤峰市', + text: '市辖区', + value: '150401' + }, + { + city: '赤峰市', + text: '红山区', + value: '150402' + }, + { + city: '赤峰市', + text: '元宝山区', + value: '150403' + }, + { + city: '赤峰市', + text: '松山区', + value: '150404' + }, + { + city: '赤峰市', + text: '阿鲁科尔沁旗', + value: '150421' + }, + { + city: '赤峰市', + text: '巴林左旗', + value: '150422' + }, + { + city: '赤峰市', + text: '巴林右旗', + value: '150423' + }, + { + city: '赤峰市', + text: '林西县', + value: '150424' + }, + { + city: '赤峰市', + text: '克什克腾旗', + value: '150425' + }, + { + city: '赤峰市', + text: '翁牛特旗', + value: '150426' + }, + { + city: '赤峰市', + text: '喀喇沁旗', + value: '150428' + }, + { + city: '赤峰市', + text: '宁城县', + value: '150429' + }, + { + city: '赤峰市', + text: '敖汉旗', + value: '150430' + } + ], + '150500': [ + { + city: '通辽市', + text: '市辖区', + value: '150501' + }, + { + city: '通辽市', + text: '科尔沁区', + value: '150502' + }, + { + city: '通辽市', + text: '科尔沁左翼中旗', + value: '150521' + }, + { + city: '通辽市', + text: '科尔沁左翼后旗', + value: '150522' + }, + { + city: '通辽市', + text: '开鲁县', + value: '150523' + }, + { + city: '通辽市', + text: '库伦旗', + value: '150524' + }, + { + city: '通辽市', + text: '奈曼旗', + value: '150525' + }, + { + city: '通辽市', + text: '扎鲁特旗', + value: '150526' + }, + { + city: '通辽市', + text: '霍林郭勒市', + value: '150581' + } + ], + '150600': [ + { + city: '鄂尔多斯市', + text: '市辖区', + value: '150601' + }, + { + city: '鄂尔多斯市', + text: '东胜区', + value: '150602' + }, + { + city: '鄂尔多斯市', + text: '康巴什区', + value: '150603' + }, + { + city: '鄂尔多斯市', + text: '达拉特旗', + value: '150621' + }, + { + city: '鄂尔多斯市', + text: '准格尔旗', + value: '150622' + }, + { + city: '鄂尔多斯市', + text: '鄂托克前旗', + value: '150623' + }, + { + city: '鄂尔多斯市', + text: '鄂托克旗', + value: '150624' + }, + { + city: '鄂尔多斯市', + text: '杭锦旗', + value: '150625' + }, + { + city: '鄂尔多斯市', + text: '乌审旗', + value: '150626' + }, + { + city: '鄂尔多斯市', + text: '伊金霍洛旗', + value: '150627' + } + ], + '150700': [ + { + city: '呼伦贝尔市', + text: '市辖区', + value: '150701' + }, + { + city: '呼伦贝尔市', + text: '海拉尔区', + value: '150702' + }, + { + city: '呼伦贝尔市', + text: '扎赉诺尔区', + value: '150703' + }, + { + city: '呼伦贝尔市', + text: '阿荣旗', + value: '150721' + }, + { + city: '呼伦贝尔市', + text: '莫力达瓦达斡尔族自治旗', + value: '150722' + }, + { + city: '呼伦贝尔市', + text: '鄂伦春自治旗', + value: '150723' + }, + { + city: '呼伦贝尔市', + text: '鄂温克族自治旗', + value: '150724' + }, + { + city: '呼伦贝尔市', + text: '陈巴尔虎旗', + value: '150725' + }, + { + city: '呼伦贝尔市', + text: '新巴尔虎左旗', + value: '150726' + }, + { + city: '呼伦贝尔市', + text: '新巴尔虎右旗', + value: '150727' + }, + { + city: '呼伦贝尔市', + text: '满洲里市', + value: '150781' + }, + { + city: '呼伦贝尔市', + text: '牙克石市', + value: '150782' + }, + { + city: '呼伦贝尔市', + text: '扎兰屯市', + value: '150783' + }, + { + city: '呼伦贝尔市', + text: '额尔古纳市', + value: '150784' + }, + { + city: '呼伦贝尔市', + text: '根河市', + value: '150785' + } + ], + '150800': [ + { + city: '巴彦淖尔市', + text: '市辖区', + value: '150801' + }, + { + city: '巴彦淖尔市', + text: '临河区', + value: '150802' + }, + { + city: '巴彦淖尔市', + text: '五原县', + value: '150821' + }, + { + city: '巴彦淖尔市', + text: '磴口县', + value: '150822' + }, + { + city: '巴彦淖尔市', + text: '乌拉特前旗', + value: '150823' + }, + { + city: '巴彦淖尔市', + text: '乌拉特中旗', + value: '150824' + }, + { + city: '巴彦淖尔市', + text: '乌拉特后旗', + value: '150825' + }, + { + city: '巴彦淖尔市', + text: '杭锦后旗', + value: '150826' + } + ], + '150900': [ + { + city: '乌兰察布市', + text: '市辖区', + value: '150901' + }, + { + city: '乌兰察布市', + text: '集宁区', + value: '150902' + }, + { + city: '乌兰察布市', + text: '卓资县', + value: '150921' + }, + { + city: '乌兰察布市', + text: '化德县', + value: '150922' + }, + { + city: '乌兰察布市', + text: '商都县', + value: '150923' + }, + { + city: '乌兰察布市', + text: '兴和县', + value: '150924' + }, + { + city: '乌兰察布市', + text: '凉城县', + value: '150925' + }, + { + city: '乌兰察布市', + text: '察哈尔右翼前旗', + value: '150926' + }, + { + city: '乌兰察布市', + text: '察哈尔右翼中旗', + value: '150927' + }, + { + city: '乌兰察布市', + text: '察哈尔右翼后旗', + value: '150928' + }, + { + city: '乌兰察布市', + text: '四子王旗', + value: '150929' + }, + { + city: '乌兰察布市', + text: '丰镇市', + value: '150981' + } + ], + '152200': [ + { + city: '兴安盟', + text: '乌兰浩特市', + value: '152201' + }, + { + city: '兴安盟', + text: '阿尔山市', + value: '152202' + }, + { + city: '兴安盟', + text: '科尔沁右翼前旗', + value: '152221' + }, + { + city: '兴安盟', + text: '科尔沁右翼中旗', + value: '152222' + }, + { + city: '兴安盟', + text: '扎赉特旗', + value: '152223' + }, + { + city: '兴安盟', + text: '突泉县', + value: '152224' + } + ], + '152500': [ + { + city: '锡林郭勒盟', + text: '二连浩特市', + value: '152501' + }, + { + city: '锡林郭勒盟', + text: '锡林浩特市', + value: '152502' + }, + { + city: '锡林郭勒盟', + text: '阿巴嘎旗', + value: '152522' + }, + { + city: '锡林郭勒盟', + text: '苏尼特左旗', + value: '152523' + }, + { + city: '锡林郭勒盟', + text: '苏尼特右旗', + value: '152524' + }, + { + city: '锡林郭勒盟', + text: '东乌珠穆沁旗', + value: '152525' + }, + { + city: '锡林郭勒盟', + text: '西乌珠穆沁旗', + value: '152526' + }, + { + city: '锡林郭勒盟', + text: '太仆寺旗', + value: '152527' + }, + { + city: '锡林郭勒盟', + text: '镶黄旗', + value: '152528' + }, + { + city: '锡林郭勒盟', + text: '正镶白旗', + value: '152529' + }, + { + city: '锡林郭勒盟', + text: '正蓝旗', + value: '152530' + }, + { + city: '锡林郭勒盟', + text: '多伦县', + value: '152531' + } + ], + '152900': [ + { + city: '阿拉善盟', + text: '阿拉善左旗', + value: '152921' + }, + { + city: '阿拉善盟', + text: '阿拉善右旗', + value: '152922' + }, + { + city: '阿拉善盟', + text: '额济纳旗', + value: '152923' + } + ], + '210100': [ + { + city: '沈阳市', + text: '市辖区', + value: '210101' + }, + { + city: '沈阳市', + text: '和平区', + value: '210102' + }, + { + city: '沈阳市', + text: '沈河区', + value: '210103' + }, + { + city: '沈阳市', + text: '大东区', + value: '210104' + }, + { + city: '沈阳市', + text: '皇姑区', + value: '210105' + }, + { + city: '沈阳市', + text: '铁西区', + value: '210106' + }, + { + city: '沈阳市', + text: '苏家屯区', + value: '210111' + }, + { + city: '沈阳市', + text: '浑南区', + value: '210112' + }, + { + city: '沈阳市', + text: '沈北新区', + value: '210113' + }, + { + city: '沈阳市', + text: '于洪区', + value: '210114' + }, + { + city: '沈阳市', + text: '辽中区', + value: '210115' + }, + { + city: '沈阳市', + text: '康平县', + value: '210123' + }, + { + city: '沈阳市', + text: '法库县', + value: '210124' + }, + { + city: '沈阳市', + text: '新民市', + value: '210181' + } + ], + '210200': [ + { + city: '大连市', + text: '市辖区', + value: '210201' + }, + { + city: '大连市', + text: '中山区', + value: '210202' + }, + { + city: '大连市', + text: '西岗区', + value: '210203' + }, + { + city: '大连市', + text: '沙河口区', + value: '210204' + }, + { + city: '大连市', + text: '甘井子区', + value: '210211' + }, + { + city: '大连市', + text: '旅顺口区', + value: '210212' + }, + { + city: '大连市', + text: '金州区', + value: '210213' + }, + { + city: '大连市', + text: '普兰店区', + value: '210214' + }, + { + city: '大连市', + text: '长海县', + value: '210224' + }, + { + city: '大连市', + text: '瓦房店市', + value: '210281' + }, + { + city: '大连市', + text: '庄河市', + value: '210283' + } + ], + '210300': [ + { + city: '鞍山市', + text: '市辖区', + value: '210301' + }, + { + city: '鞍山市', + text: '铁东区', + value: '210302' + }, + { + city: '鞍山市', + text: '铁西区', + value: '210303' + }, + { + city: '鞍山市', + text: '立山区', + value: '210304' + }, + { + city: '鞍山市', + text: '千山区', + value: '210311' + }, + { + city: '鞍山市', + text: '台安县', + value: '210321' + }, + { + city: '鞍山市', + text: '岫岩满族自治县', + value: '210323' + }, + { + city: '鞍山市', + text: '海城市', + value: '210381' + } + ], + '210400': [ + { + city: '抚顺市', + text: '市辖区', + value: '210401' + }, + { + city: '抚顺市', + text: '新抚区', + value: '210402' + }, + { + city: '抚顺市', + text: '东洲区', + value: '210403' + }, + { + city: '抚顺市', + text: '望花区', + value: '210404' + }, + { + city: '抚顺市', + text: '顺城区', + value: '210411' + }, + { + city: '抚顺市', + text: '抚顺县', + value: '210421' + }, + { + city: '抚顺市', + text: '新宾满族自治县', + value: '210422' + }, + { + city: '抚顺市', + text: '清原满族自治县', + value: '210423' + } + ], + '210500': [ + { + city: '本溪市', + text: '市辖区', + value: '210501' + }, + { + city: '本溪市', + text: '平山区', + value: '210502' + }, + { + city: '本溪市', + text: '溪湖区', + value: '210503' + }, + { + city: '本溪市', + text: '明山区', + value: '210504' + }, + { + city: '本溪市', + text: '南芬区', + value: '210505' + }, + { + city: '本溪市', + text: '本溪满族自治县', + value: '210521' + }, + { + city: '本溪市', + text: '桓仁满族自治县', + value: '210522' + } + ], + '210600': [ + { + city: '丹东市', + text: '市辖区', + value: '210601' + }, + { + city: '丹东市', + text: '元宝区', + value: '210602' + }, + { + city: '丹东市', + text: '振兴区', + value: '210603' + }, + { + city: '丹东市', + text: '振安区', + value: '210604' + }, + { + city: '丹东市', + text: '宽甸满族自治县', + value: '210624' + }, + { + city: '丹东市', + text: '东港市', + value: '210681' + }, + { + city: '丹东市', + text: '凤城市', + value: '210682' + } + ], + '210700': [ + { + city: '锦州市', + text: '市辖区', + value: '210701' + }, + { + city: '锦州市', + text: '古塔区', + value: '210702' + }, + { + city: '锦州市', + text: '凌河区', + value: '210703' + }, + { + city: '锦州市', + text: '太和区', + value: '210711' + }, + { + city: '锦州市', + text: '黑山县', + value: '210726' + }, + { + city: '锦州市', + text: '义县', + value: '210727' + }, + { + city: '锦州市', + text: '凌海市', + value: '210781' + }, + { + city: '锦州市', + text: '北镇市', + value: '210782' + } + ], + '210800': [ + { + city: '营口市', + text: '市辖区', + value: '210801' + }, + { + city: '营口市', + text: '站前区', + value: '210802' + }, + { + city: '营口市', + text: '西市区', + value: '210803' + }, + { + city: '营口市', + text: '鲅鱼圈区', + value: '210804' + }, + { + city: '营口市', + text: '老边区', + value: '210811' + }, + { + city: '营口市', + text: '盖州市', + value: '210881' + }, + { + city: '营口市', + text: '大石桥市', + value: '210882' + } + ], + '210900': [ + { + city: '阜新市', + text: '市辖区', + value: '210901' + }, + { + city: '阜新市', + text: '海州区', + value: '210902' + }, + { + city: '阜新市', + text: '新邱区', + value: '210903' + }, + { + city: '阜新市', + text: '太平区', + value: '210904' + }, + { + city: '阜新市', + text: '清河门区', + value: '210905' + }, + { + city: '阜新市', + text: '细河区', + value: '210911' + }, + { + city: '阜新市', + text: '阜新蒙古族自治县', + value: '210921' + }, + { + city: '阜新市', + text: '彰武县', + value: '210922' + } + ], + '211000': [ + { + city: '辽阳市', + text: '市辖区', + value: '211001' + }, + { + city: '辽阳市', + text: '白塔区', + value: '211002' + }, + { + city: '辽阳市', + text: '文圣区', + value: '211003' + }, + { + city: '辽阳市', + text: '宏伟区', + value: '211004' + }, + { + city: '辽阳市', + text: '弓长岭区', + value: '211005' + }, + { + city: '辽阳市', + text: '太子河区', + value: '211011' + }, + { + city: '辽阳市', + text: '辽阳县', + value: '211021' + }, + { + city: '辽阳市', + text: '灯塔市', + value: '211081' + } + ], + '211100': [ + { + city: '盘锦市', + text: '市辖区', + value: '211101' + }, + { + city: '盘锦市', + text: '双台子区', + value: '211102' + }, + { + city: '盘锦市', + text: '兴隆台区', + value: '211103' + }, + { + city: '盘锦市', + text: '大洼区', + value: '211104' + }, + { + city: '盘锦市', + text: '盘山县', + value: '211122' + } + ], + '211200': [ + { + city: '铁岭市', + text: '市辖区', + value: '211201' + }, + { + city: '铁岭市', + text: '银州区', + value: '211202' + }, + { + city: '铁岭市', + text: '清河区', + value: '211204' + }, + { + city: '铁岭市', + text: '铁岭县', + value: '211221' + }, + { + city: '铁岭市', + text: '西丰县', + value: '211223' + }, + { + city: '铁岭市', + text: '昌图县', + value: '211224' + }, + { + city: '铁岭市', + text: '调兵山市', + value: '211281' + }, + { + city: '铁岭市', + text: '开原市', + value: '211282' + } + ], + '211300': [ + { + city: '朝阳市', + text: '市辖区', + value: '211301' + }, + { + city: '朝阳市', + text: '双塔区', + value: '211302' + }, + { + city: '朝阳市', + text: '龙城区', + value: '211303' + }, + { + city: '朝阳市', + text: '朝阳县', + value: '211321' + }, + { + city: '朝阳市', + text: '建平县', + value: '211322' + }, + { + city: '朝阳市', + text: '喀喇沁左翼蒙古族自治县', + value: '211324' + }, + { + city: '朝阳市', + text: '北票市', + value: '211381' + }, + { + city: '朝阳市', + text: '凌源市', + value: '211382' + } + ], + '211400': [ + { + city: '葫芦岛市', + text: '市辖区', + value: '211401' + }, + { + city: '葫芦岛市', + text: '连山区', + value: '211402' + }, + { + city: '葫芦岛市', + text: '龙港区', + value: '211403' + }, + { + city: '葫芦岛市', + text: '南票区', + value: '211404' + }, + { + city: '葫芦岛市', + text: '绥中县', + value: '211421' + }, + { + city: '葫芦岛市', + text: '建昌县', + value: '211422' + }, + { + city: '葫芦岛市', + text: '兴城市', + value: '211481' + } + ], + '220100': [ + { + city: '长春市', + text: '市辖区', + value: '220101' + }, + { + city: '长春市', + text: '南关区', + value: '220102' + }, + { + city: '长春市', + text: '宽城区', + value: '220103' + }, + { + city: '长春市', + text: '朝阳区', + value: '220104' + }, + { + city: '长春市', + text: '二道区', + value: '220105' + }, + { + city: '长春市', + text: '绿园区', + value: '220106' + }, + { + city: '长春市', + text: '双阳区', + value: '220112' + }, + { + city: '长春市', + text: '九台区', + value: '220113' + }, + { + city: '长春市', + text: '农安县', + value: '220122' + }, + { + city: '长春市', + text: '榆树市', + value: '220182' + }, + { + city: '长春市', + text: '德惠市', + value: '220183' + } + ], + '220200': [ + { + city: '吉林市', + text: '市辖区', + value: '220201' + }, + { + city: '吉林市', + text: '昌邑区', + value: '220202' + }, + { + city: '吉林市', + text: '龙潭区', + value: '220203' + }, + { + city: '吉林市', + text: '船营区', + value: '220204' + }, + { + city: '吉林市', + text: '丰满区', + value: '220211' + }, + { + city: '吉林市', + text: '永吉县', + value: '220221' + }, + { + city: '吉林市', + text: '蛟河市', + value: '220281' + }, + { + city: '吉林市', + text: '桦甸市', + value: '220282' + }, + { + city: '吉林市', + text: '舒兰市', + value: '220283' + }, + { + city: '吉林市', + text: '磐石市', + value: '220284' + } + ], + '220300': [ + { + city: '四平市', + text: '市辖区', + value: '220301' + }, + { + city: '四平市', + text: '铁西区', + value: '220302' + }, + { + city: '四平市', + text: '铁东区', + value: '220303' + }, + { + city: '四平市', + text: '梨树县', + value: '220322' + }, + { + city: '四平市', + text: '伊通满族自治县', + value: '220323' + }, + { + city: '四平市', + text: '公主岭市', + value: '220381' + }, + { + city: '四平市', + text: '双辽市', + value: '220382' + } + ], + '220400': [ + { + city: '辽源市', + text: '市辖区', + value: '220401' + }, + { + city: '辽源市', + text: '龙山区', + value: '220402' + }, + { + city: '辽源市', + text: '西安区', + value: '220403' + }, + { + city: '辽源市', + text: '东丰县', + value: '220421' + }, + { + city: '辽源市', + text: '东辽县', + value: '220422' + } + ], + '220500': [ + { + city: '通化市', + text: '市辖区', + value: '220501' + }, + { + city: '通化市', + text: '东昌区', + value: '220502' + }, + { + city: '通化市', + text: '二道江区', + value: '220503' + }, + { + city: '通化市', + text: '通化县', + value: '220521' + }, + { + city: '通化市', + text: '辉南县', + value: '220523' + }, + { + city: '通化市', + text: '柳河县', + value: '220524' + }, + { + city: '通化市', + text: '梅河口市', + value: '220581' + }, + { + city: '通化市', + text: '集安市', + value: '220582' + } + ], + '220600': [ + { + city: '白山市', + text: '市辖区', + value: '220601' + }, + { + city: '白山市', + text: '浑江区', + value: '220602' + }, + { + city: '白山市', + text: '江源区', + value: '220605' + }, + { + city: '白山市', + text: '抚松县', + value: '220621' + }, + { + city: '白山市', + text: '靖宇县', + value: '220622' + }, + { + city: '白山市', + text: '长白朝鲜族自治县', + value: '220623' + }, + { + city: '白山市', + text: '临江市', + value: '220681' + } + ], + '220700': [ + { + city: '松原市', + text: '市辖区', + value: '220701' + }, + { + city: '松原市', + text: '宁江区', + value: '220702' + }, + { + city: '松原市', + text: '前郭尔罗斯蒙古族自治县', + value: '220721' + }, + { + city: '松原市', + text: '长岭县', + value: '220722' + }, + { + city: '松原市', + text: '乾安县', + value: '220723' + }, + { + city: '松原市', + text: '扶余市', + value: '220781' + } + ], + '220800': [ + { + city: '白城市', + text: '市辖区', + value: '220801' + }, + { + city: '白城市', + text: '洮北区', + value: '220802' + }, + { + city: '白城市', + text: '镇赉县', + value: '220821' + }, + { + city: '白城市', + text: '通榆县', + value: '220822' + }, + { + city: '白城市', + text: '洮南市', + value: '220881' + }, + { + city: '白城市', + text: '大安市', + value: '220882' + } + ], + '222400': [ + { + city: '延边朝鲜族自治州', + text: '延吉市', + value: '222401' + }, + { + city: '延边朝鲜族自治州', + text: '图们市', + value: '222402' + }, + { + city: '延边朝鲜族自治州', + text: '敦化市', + value: '222403' + }, + { + city: '延边朝鲜族自治州', + text: '珲春市', + value: '222404' + }, + { + city: '延边朝鲜族自治州', + text: '龙井市', + value: '222405' + }, + { + city: '延边朝鲜族自治州', + text: '和龙市', + value: '222406' + }, + { + city: '延边朝鲜族自治州', + text: '汪清县', + value: '222424' + }, + { + city: '延边朝鲜族自治州', + text: '安图县', + value: '222426' + } + ], + '230100': [ + { + city: '哈尔滨市', + text: '市辖区', + value: '230101' + }, + { + city: '哈尔滨市', + text: '道里区', + value: '230102' + }, + { + city: '哈尔滨市', + text: '南岗区', + value: '230103' + }, + { + city: '哈尔滨市', + text: '道外区', + value: '230104' + }, + { + city: '哈尔滨市', + text: '平房区', + value: '230108' + }, + { + city: '哈尔滨市', + text: '松北区', + value: '230109' + }, + { + city: '哈尔滨市', + text: '香坊区', + value: '230110' + }, + { + city: '哈尔滨市', + text: '呼兰区', + value: '230111' + }, + { + city: '哈尔滨市', + text: '阿城区', + value: '230112' + }, + { + city: '哈尔滨市', + text: '双城区', + value: '230113' + }, + { + city: '哈尔滨市', + text: '依兰县', + value: '230123' + }, + { + city: '哈尔滨市', + text: '方正县', + value: '230124' + }, + { + city: '哈尔滨市', + text: '宾县', + value: '230125' + }, + { + city: '哈尔滨市', + text: '巴彦县', + value: '230126' + }, + { + city: '哈尔滨市', + text: '木兰县', + value: '230127' + }, + { + city: '哈尔滨市', + text: '通河县', + value: '230128' + }, + { + city: '哈尔滨市', + text: '延寿县', + value: '230129' + }, + { + city: '哈尔滨市', + text: '尚志市', + value: '230183' + }, + { + city: '哈尔滨市', + text: '五常市', + value: '230184' + } + ], + '230200': [ + { + city: '齐齐哈尔市', + text: '市辖区', + value: '230201' + }, + { + city: '齐齐哈尔市', + text: '龙沙区', + value: '230202' + }, + { + city: '齐齐哈尔市', + text: '建华区', + value: '230203' + }, + { + city: '齐齐哈尔市', + text: '铁锋区', + value: '230204' + }, + { + city: '齐齐哈尔市', + text: '昂昂溪区', + value: '230205' + }, + { + city: '齐齐哈尔市', + text: '富拉尔基区', + value: '230206' + }, + { + city: '齐齐哈尔市', + text: '碾子山区', + value: '230207' + }, + { + city: '齐齐哈尔市', + text: '梅里斯达斡尔族区', + value: '230208' + }, + { + city: '齐齐哈尔市', + text: '龙江县', + value: '230221' + }, + { + city: '齐齐哈尔市', + text: '依安县', + value: '230223' + }, + { + city: '齐齐哈尔市', + text: '泰来县', + value: '230224' + }, + { + city: '齐齐哈尔市', + text: '甘南县', + value: '230225' + }, + { + city: '齐齐哈尔市', + text: '富裕县', + value: '230227' + }, + { + city: '齐齐哈尔市', + text: '克山县', + value: '230229' + }, + { + city: '齐齐哈尔市', + text: '克东县', + value: '230230' + }, + { + city: '齐齐哈尔市', + text: '拜泉县', + value: '230231' + }, + { + city: '齐齐哈尔市', + text: '讷河市', + value: '230281' + } + ], + '230300': [ + { + city: '鸡西市', + text: '市辖区', + value: '230301' + }, + { + city: '鸡西市', + text: '鸡冠区', + value: '230302' + }, + { + city: '鸡西市', + text: '恒山区', + value: '230303' + }, + { + city: '鸡西市', + text: '滴道区', + value: '230304' + }, + { + city: '鸡西市', + text: '梨树区', + value: '230305' + }, + { + city: '鸡西市', + text: '城子河区', + value: '230306' + }, + { + city: '鸡西市', + text: '麻山区', + value: '230307' + }, + { + city: '鸡西市', + text: '鸡东县', + value: '230321' + }, + { + city: '鸡西市', + text: '虎林市', + value: '230381' + }, + { + city: '鸡西市', + text: '密山市', + value: '230382' + } + ], + '230400': [ + { + city: '鹤岗市', + text: '市辖区', + value: '230401' + }, + { + city: '鹤岗市', + text: '向阳区', + value: '230402' + }, + { + city: '鹤岗市', + text: '工农区', + value: '230403' + }, + { + city: '鹤岗市', + text: '南山区', + value: '230404' + }, + { + city: '鹤岗市', + text: '兴安区', + value: '230405' + }, + { + city: '鹤岗市', + text: '东山区', + value: '230406' + }, + { + city: '鹤岗市', + text: '兴山区', + value: '230407' + }, + { + city: '鹤岗市', + text: '萝北县', + value: '230421' + }, + { + city: '鹤岗市', + text: '绥滨县', + value: '230422' + } + ], + '230500': [ + { + city: '双鸭山市', + text: '市辖区', + value: '230501' + }, + { + city: '双鸭山市', + text: '尖山区', + value: '230502' + }, + { + city: '双鸭山市', + text: '岭东区', + value: '230503' + }, + { + city: '双鸭山市', + text: '四方台区', + value: '230505' + }, + { + city: '双鸭山市', + text: '宝山区', + value: '230506' + }, + { + city: '双鸭山市', + text: '集贤县', + value: '230521' + }, + { + city: '双鸭山市', + text: '友谊县', + value: '230522' + }, + { + city: '双鸭山市', + text: '宝清县', + value: '230523' + }, + { + city: '双鸭山市', + text: '饶河县', + value: '230524' + } + ], + '230600': [ + { + city: '大庆市', + text: '市辖区', + value: '230601' + }, + { + city: '大庆市', + text: '萨尔图区', + value: '230602' + }, + { + city: '大庆市', + text: '龙凤区', + value: '230603' + }, + { + city: '大庆市', + text: '让胡路区', + value: '230604' + }, + { + city: '大庆市', + text: '红岗区', + value: '230605' + }, + { + city: '大庆市', + text: '大同区', + value: '230606' + }, + { + city: '大庆市', + text: '肇州县', + value: '230621' + }, + { + city: '大庆市', + text: '肇源县', + value: '230622' + }, + { + city: '大庆市', + text: '林甸县', + value: '230623' + }, + { + city: '大庆市', + text: '杜尔伯特蒙古族自治县', + value: '230624' + } + ], + '230700': [ + { + city: '伊春市', + text: '市辖区', + value: '230701' + }, + { + city: '伊春市', + text: '伊春区', + value: '230702' + }, + { + city: '伊春市', + text: '南岔区', + value: '230703' + }, + { + city: '伊春市', + text: '友好区', + value: '230704' + }, + { + city: '伊春市', + text: '西林区', + value: '230705' + }, + { + city: '伊春市', + text: '翠峦区', + value: '230706' + }, + { + city: '伊春市', + text: '新青区', + value: '230707' + }, + { + city: '伊春市', + text: '美溪区', + value: '230708' + }, + { + city: '伊春市', + text: '金山屯区', + value: '230709' + }, + { + city: '伊春市', + text: '五营区', + value: '230710' + }, + { + city: '伊春市', + text: '乌马河区', + value: '230711' + }, + { + city: '伊春市', + text: '汤旺河区', + value: '230712' + }, + { + city: '伊春市', + text: '带岭区', + value: '230713' + }, + { + city: '伊春市', + text: '乌伊岭区', + value: '230714' + }, + { + city: '伊春市', + text: '红星区', + value: '230715' + }, + { + city: '伊春市', + text: '上甘岭区', + value: '230716' + }, + { + city: '伊春市', + text: '嘉荫县', + value: '230722' + }, + { + city: '伊春市', + text: '铁力市', + value: '230781' + } + ], + '230800': [ + { + city: '佳木斯市', + text: '市辖区', + value: '230801' + }, + { + city: '佳木斯市', + text: '向阳区', + value: '230803' + }, + { + city: '佳木斯市', + text: '前进区', + value: '230804' + }, + { + city: '佳木斯市', + text: '东风区', + value: '230805' + }, + { + city: '佳木斯市', + text: '郊区', + value: '230811' + }, + { + city: '佳木斯市', + text: '桦南县', + value: '230822' + }, + { + city: '佳木斯市', + text: '桦川县', + value: '230826' + }, + { + city: '佳木斯市', + text: '汤原县', + value: '230828' + }, + { + city: '佳木斯市', + text: '同江市', + value: '230881' + }, + { + city: '佳木斯市', + text: '富锦市', + value: '230882' + }, + { + city: '佳木斯市', + text: '抚远市', + value: '230883' + } + ], + '230900': [ + { + city: '七台河市', + text: '市辖区', + value: '230901' + }, + { + city: '七台河市', + text: '新兴区', + value: '230902' + }, + { + city: '七台河市', + text: '桃山区', + value: '230903' + }, + { + city: '七台河市', + text: '茄子河区', + value: '230904' + }, + { + city: '七台河市', + text: '勃利县', + value: '230921' + } + ], + '231000': [ + { + city: '牡丹江市', + text: '市辖区', + value: '231001' + }, + { + city: '牡丹江市', + text: '东安区', + value: '231002' + }, + { + city: '牡丹江市', + text: '阳明区', + value: '231003' + }, + { + city: '牡丹江市', + text: '爱民区', + value: '231004' + }, + { + city: '牡丹江市', + text: '西安区', + value: '231005' + }, + { + city: '牡丹江市', + text: '林口县', + value: '231025' + }, + { + city: '牡丹江市', + text: '绥芬河市', + value: '231081' + }, + { + city: '牡丹江市', + text: '海林市', + value: '231083' + }, + { + city: '牡丹江市', + text: '宁安市', + value: '231084' + }, + { + city: '牡丹江市', + text: '穆棱市', + value: '231085' + }, + { + city: '牡丹江市', + text: '东宁市', + value: '231086' + } + ], + '231100': [ + { + city: '黑河市', + text: '市辖区', + value: '231101' + }, + { + city: '黑河市', + text: '爱辉区', + value: '231102' + }, + { + city: '黑河市', + text: '嫩江县', + value: '231121' + }, + { + city: '黑河市', + text: '逊克县', + value: '231123' + }, + { + city: '黑河市', + text: '孙吴县', + value: '231124' + }, + { + city: '黑河市', + text: '北安市', + value: '231181' + }, + { + city: '黑河市', + text: '五大连池市', + value: '231182' + } + ], + '231200': [ + { + city: '绥化市', + text: '市辖区', + value: '231201' + }, + { + city: '绥化市', + text: '北林区', + value: '231202' + }, + { + city: '绥化市', + text: '望奎县', + value: '231221' + }, + { + city: '绥化市', + text: '兰西县', + value: '231222' + }, + { + city: '绥化市', + text: '青冈县', + value: '231223' + }, + { + city: '绥化市', + text: '庆安县', + value: '231224' + }, + { + city: '绥化市', + text: '明水县', + value: '231225' + }, + { + city: '绥化市', + text: '绥棱县', + value: '231226' + }, + { + city: '绥化市', + text: '安达市', + value: '231281' + }, + { + city: '绥化市', + text: '肇东市', + value: '231282' + }, + { + city: '绥化市', + text: '海伦市', + value: '231283' + } + ], + '232700': [ + { + city: '大兴安岭地区', + text: '呼玛县', + value: '232721' + }, + { + city: '大兴安岭地区', + text: '塔河县', + value: '232722' + }, + { + city: '大兴安岭地区', + text: '漠河县', + value: '232723' + } + ], + '310100': [ + { + city: '市辖区', + text: '黄浦区', + value: '310101' + }, + { + city: '市辖区', + text: '徐汇区', + value: '310104' + }, + { + city: '市辖区', + text: '长宁区', + value: '310105' + }, + { + city: '市辖区', + text: '静安区', + value: '310106' + }, + { + city: '市辖区', + text: '普陀区', + value: '310107' + }, + { + city: '市辖区', + text: '虹口区', + value: '310109' + }, + { + city: '市辖区', + text: '杨浦区', + value: '310110' + }, + { + city: '市辖区', + text: '闵行区', + value: '310112' + }, + { + city: '市辖区', + text: '宝山区', + value: '310113' + }, + { + city: '市辖区', + text: '嘉定区', + value: '310114' + }, + { + city: '市辖区', + text: '浦东新区', + value: '310115' + }, + { + city: '市辖区', + text: '金山区', + value: '310116' + }, + { + city: '市辖区', + text: '松江区', + value: '310117' + }, + { + city: '市辖区', + text: '青浦区', + value: '310118' + }, + { + city: '市辖区', + text: '奉贤区', + value: '310120' + }, + { + city: '市辖区', + text: '崇明区', + value: '310151' + } + ], + '320100': [ + { + city: '南京市', + text: '市辖区', + value: '320101' + }, + { + city: '南京市', + text: '玄武区', + value: '320102' + }, + { + city: '南京市', + text: '秦淮区', + value: '320104' + }, + { + city: '南京市', + text: '建邺区', + value: '320105' + }, + { + city: '南京市', + text: '鼓楼区', + value: '320106' + }, + { + city: '南京市', + text: '浦口区', + value: '320111' + }, + { + city: '南京市', + text: '栖霞区', + value: '320113' + }, + { + city: '南京市', + text: '雨花台区', + value: '320114' + }, + { + city: '南京市', + text: '江宁区', + value: '320115' + }, + { + city: '南京市', + text: '六合区', + value: '320116' + }, + { + city: '南京市', + text: '溧水区', + value: '320117' + }, + { + city: '南京市', + text: '高淳区', + value: '320118' + } + ], + '320200': [ + { + city: '无锡市', + text: '市辖区', + value: '320201' + }, + { + city: '无锡市', + text: '锡山区', + value: '320205' + }, + { + city: '无锡市', + text: '惠山区', + value: '320206' + }, + { + city: '无锡市', + text: '滨湖区', + value: '320211' + }, + { + city: '无锡市', + text: '梁溪区', + value: '320213' + }, + { + city: '无锡市', + text: '新吴区', + value: '320214' + }, + { + city: '无锡市', + text: '江阴市', + value: '320281' + }, + { + city: '无锡市', + text: '宜兴市', + value: '320282' + } + ], + '320300': [ + { + city: '徐州市', + text: '市辖区', + value: '320301' + }, + { + city: '徐州市', + text: '鼓楼区', + value: '320302' + }, + { + city: '徐州市', + text: '云龙区', + value: '320303' + }, + { + city: '徐州市', + text: '贾汪区', + value: '320305' + }, + { + city: '徐州市', + text: '泉山区', + value: '320311' + }, + { + city: '徐州市', + text: '铜山区', + value: '320312' + }, + { + city: '徐州市', + text: '丰县', + value: '320321' + }, + { + city: '徐州市', + text: '沛县', + value: '320322' + }, + { + city: '徐州市', + text: '睢宁县', + value: '320324' + }, + { + city: '徐州市', + text: '新沂市', + value: '320381' + }, + { + city: '徐州市', + text: '邳州市', + value: '320382' + } + ], + '320400': [ + { + city: '常州市', + text: '市辖区', + value: '320401' + }, + { + city: '常州市', + text: '天宁区', + value: '320402' + }, + { + city: '常州市', + text: '钟楼区', + value: '320404' + }, + { + city: '常州市', + text: '新北区', + value: '320411' + }, + { + city: '常州市', + text: '武进区', + value: '320412' + }, + { + city: '常州市', + text: '金坛区', + value: '320413' + }, + { + city: '常州市', + text: '溧阳市', + value: '320481' + } + ], + '320500': [ + { + city: '苏州市', + text: '市辖区', + value: '320501' + }, + { + city: '苏州市', + text: '虎丘区', + value: '320505' + }, + { + city: '苏州市', + text: '吴中区', + value: '320506' + }, + { + city: '苏州市', + text: '相城区', + value: '320507' + }, + { + city: '苏州市', + text: '姑苏区', + value: '320508' + }, + { + city: '苏州市', + text: '吴江区', + value: '320509' + }, + { + city: '苏州市', + text: '常熟市', + value: '320581' + }, + { + city: '苏州市', + text: '张家港市', + value: '320582' + }, + { + city: '苏州市', + text: '昆山市', + value: '320583' + }, + { + city: '苏州市', + text: '太仓市', + value: '320585' + } + ], + '320600': [ + { + city: '南通市', + text: '市辖区', + value: '320601' + }, + { + city: '南通市', + text: '崇川区', + value: '320602' + }, + { + city: '南通市', + text: '港闸区', + value: '320611' + }, + { + city: '南通市', + text: '通州区', + value: '320612' + }, + { + city: '南通市', + text: '海安县', + value: '320621' + }, + { + city: '南通市', + text: '如东县', + value: '320623' + }, + { + city: '南通市', + text: '启东市', + value: '320681' + }, + { + city: '南通市', + text: '如皋市', + value: '320682' + }, + { + city: '南通市', + text: '海门市', + value: '320684' + } + ], + '320700': [ + { + city: '连云港市', + text: '市辖区', + value: '320701' + }, + { + city: '连云港市', + text: '连云区', + value: '320703' + }, + { + city: '连云港市', + text: '海州区', + value: '320706' + }, + { + city: '连云港市', + text: '赣榆区', + value: '320707' + }, + { + city: '连云港市', + text: '东海县', + value: '320722' + }, + { + city: '连云港市', + text: '灌云县', + value: '320723' + }, + { + city: '连云港市', + text: '灌南县', + value: '320724' + } + ], + '320800': [ + { + city: '淮安市', + text: '市辖区', + value: '320801' + }, + { + city: '淮安市', + text: '淮安区', + value: '320803' + }, + { + city: '淮安市', + text: '淮阴区', + value: '320804' + }, + { + city: '淮安市', + text: '清江浦区', + value: '320812' + }, + { + city: '淮安市', + text: '洪泽区', + value: '320813' + }, + { + city: '淮安市', + text: '涟水县', + value: '320826' + }, + { + city: '淮安市', + text: '盱眙县', + value: '320830' + }, + { + city: '淮安市', + text: '金湖县', + value: '320831' + } + ], + '320900': [ + { + city: '盐城市', + text: '市辖区', + value: '320901' + }, + { + city: '盐城市', + text: '亭湖区', + value: '320902' + }, + { + city: '盐城市', + text: '盐都区', + value: '320903' + }, + { + city: '盐城市', + text: '大丰区', + value: '320904' + }, + { + city: '盐城市', + text: '响水县', + value: '320921' + }, + { + city: '盐城市', + text: '滨海县', + value: '320922' + }, + { + city: '盐城市', + text: '阜宁县', + value: '320923' + }, + { + city: '盐城市', + text: '射阳县', + value: '320924' + }, + { + city: '盐城市', + text: '建湖县', + value: '320925' + }, + { + city: '盐城市', + text: '东台市', + value: '320981' + } + ], + '321000': [ + { + city: '扬州市', + text: '市辖区', + value: '321001' + }, + { + city: '扬州市', + text: '广陵区', + value: '321002' + }, + { + city: '扬州市', + text: '邗江区', + value: '321003' + }, + { + city: '扬州市', + text: '江都区', + value: '321012' + }, + { + city: '扬州市', + text: '宝应县', + value: '321023' + }, + { + city: '扬州市', + text: '仪征市', + value: '321081' + }, + { + city: '扬州市', + text: '高邮市', + value: '321084' + } + ], + '321100': [ + { + city: '镇江市', + text: '市辖区', + value: '321101' + }, + { + city: '镇江市', + text: '京口区', + value: '321102' + }, + { + city: '镇江市', + text: '润州区', + value: '321111' + }, + { + city: '镇江市', + text: '丹徒区', + value: '321112' + }, + { + city: '镇江市', + text: '丹阳市', + value: '321181' + }, + { + city: '镇江市', + text: '扬中市', + value: '321182' + }, + { + city: '镇江市', + text: '句容市', + value: '321183' + } + ], + '321200': [ + { + city: '泰州市', + text: '市辖区', + value: '321201' + }, + { + city: '泰州市', + text: '海陵区', + value: '321202' + }, + { + city: '泰州市', + text: '高港区', + value: '321203' + }, + { + city: '泰州市', + text: '姜堰区', + value: '321204' + }, + { + city: '泰州市', + text: '兴化市', + value: '321281' + }, + { + city: '泰州市', + text: '靖江市', + value: '321282' + }, + { + city: '泰州市', + text: '泰兴市', + value: '321283' + } + ], + '321300': [ + { + city: '宿迁市', + text: '市辖区', + value: '321301' + }, + { + city: '宿迁市', + text: '宿城区', + value: '321302' + }, + { + city: '宿迁市', + text: '宿豫区', + value: '321311' + }, + { + city: '宿迁市', + text: '沭阳县', + value: '321322' + }, + { + city: '宿迁市', + text: '泗阳县', + value: '321323' + }, + { + city: '宿迁市', + text: '泗洪县', + value: '321324' + } + ], + '330100': [ + { + city: '杭州市', + text: '市辖区', + value: '330101' + }, + { + city: '杭州市', + text: '上城区', + value: '330102' + }, + { + city: '杭州市', + text: '下城区', + value: '330103' + }, + { + city: '杭州市', + text: '江干区', + value: '330104' + }, + { + city: '杭州市', + text: '拱墅区', + value: '330105' + }, + { + city: '杭州市', + text: '西湖区', + value: '330106' + }, + { + city: '杭州市', + text: '滨江区', + value: '330108' + }, + { + city: '杭州市', + text: '萧山区', + value: '330109' + }, + { + city: '杭州市', + text: '余杭区', + value: '330110' + }, + { + city: '杭州市', + text: '富阳区', + value: '330111' + }, + { + city: '杭州市', + text: '桐庐县', + value: '330122' + }, + { + city: '杭州市', + text: '淳安县', + value: '330127' + }, + { + city: '杭州市', + text: '建德市', + value: '330182' + }, + { + city: '杭州市', + text: '临安市', + value: '330185' + } + ], + '330200': [ + { + city: '宁波市', + text: '市辖区', + value: '330201' + }, + { + city: '宁波市', + text: '海曙区', + value: '330203' + }, + { + city: '宁波市', + text: '江东区', + value: '330204' + }, + { + city: '宁波市', + text: '江北区', + value: '330205' + }, + { + city: '宁波市', + text: '北仑区', + value: '330206' + }, + { + city: '宁波市', + text: '镇海区', + value: '330211' + }, + { + city: '宁波市', + text: '鄞州区', + value: '330212' + }, + { + city: '宁波市', + text: '象山县', + value: '330225' + }, + { + city: '宁波市', + text: '宁海县', + value: '330226' + }, + { + city: '宁波市', + text: '余姚市', + value: '330281' + }, + { + city: '宁波市', + text: '慈溪市', + value: '330282' + }, + { + city: '宁波市', + text: '奉化市', + value: '330283' + } + ], + '330300': [ + { + city: '温州市', + text: '市辖区', + value: '330301' + }, + { + city: '温州市', + text: '鹿城区', + value: '330302' + }, + { + city: '温州市', + text: '龙湾区', + value: '330303' + }, + { + city: '温州市', + text: '瓯海区', + value: '330304' + }, + { + city: '温州市', + text: '洞头区', + value: '330305' + }, + { + city: '温州市', + text: '永嘉县', + value: '330324' + }, + { + city: '温州市', + text: '平阳县', + value: '330326' + }, + { + city: '温州市', + text: '苍南县', + value: '330327' + }, + { + city: '温州市', + text: '文成县', + value: '330328' + }, + { + city: '温州市', + text: '泰顺县', + value: '330329' + }, + { + city: '温州市', + text: '瑞安市', + value: '330381' + }, + { + city: '温州市', + text: '乐清市', + value: '330382' + } + ], + '330400': [ + { + city: '嘉兴市', + text: '市辖区', + value: '330401' + }, + { + city: '嘉兴市', + text: '南湖区', + value: '330402' + }, + { + city: '嘉兴市', + text: '秀洲区', + value: '330411' + }, + { + city: '嘉兴市', + text: '嘉善县', + value: '330421' + }, + { + city: '嘉兴市', + text: '海盐县', + value: '330424' + }, + { + city: '嘉兴市', + text: '海宁市', + value: '330481' + }, + { + city: '嘉兴市', + text: '平湖市', + value: '330482' + }, + { + city: '嘉兴市', + text: '桐乡市', + value: '330483' + } + ], + '330500': [ + { + city: '湖州市', + text: '市辖区', + value: '330501' + }, + { + city: '湖州市', + text: '吴兴区', + value: '330502' + }, + { + city: '湖州市', + text: '南浔区', + value: '330503' + }, + { + city: '湖州市', + text: '德清县', + value: '330521' + }, + { + city: '湖州市', + text: '长兴县', + value: '330522' + }, + { + city: '湖州市', + text: '安吉县', + value: '330523' + } + ], + '330600': [ + { + city: '绍兴市', + text: '市辖区', + value: '330601' + }, + { + city: '绍兴市', + text: '越城区', + value: '330602' + }, + { + city: '绍兴市', + text: '柯桥区', + value: '330603' + }, + { + city: '绍兴市', + text: '上虞区', + value: '330604' + }, + { + city: '绍兴市', + text: '新昌县', + value: '330624' + }, + { + city: '绍兴市', + text: '诸暨市', + value: '330681' + }, + { + city: '绍兴市', + text: '嵊州市', + value: '330683' + } + ], + '330700': [ + { + city: '金华市', + text: '市辖区', + value: '330701' + }, + { + city: '金华市', + text: '婺城区', + value: '330702' + }, + { + city: '金华市', + text: '金东区', + value: '330703' + }, + { + city: '金华市', + text: '武义县', + value: '330723' + }, + { + city: '金华市', + text: '浦江县', + value: '330726' + }, + { + city: '金华市', + text: '磐安县', + value: '330727' + }, + { + city: '金华市', + text: '兰溪市', + value: '330781' + }, + { + city: '金华市', + text: '义乌市', + value: '330782' + }, + { + city: '金华市', + text: '东阳市', + value: '330783' + }, + { + city: '金华市', + text: '永康市', + value: '330784' + } + ], + '330800': [ + { + city: '衢州市', + text: '市辖区', + value: '330801' + }, + { + city: '衢州市', + text: '柯城区', + value: '330802' + }, + { + city: '衢州市', + text: '衢江区', + value: '330803' + }, + { + city: '衢州市', + text: '常山县', + value: '330822' + }, + { + city: '衢州市', + text: '开化县', + value: '330824' + }, + { + city: '衢州市', + text: '龙游县', + value: '330825' + }, + { + city: '衢州市', + text: '江山市', + value: '330881' + } + ], + '330900': [ + { + city: '舟山市', + text: '市辖区', + value: '330901' + }, + { + city: '舟山市', + text: '定海区', + value: '330902' + }, + { + city: '舟山市', + text: '普陀区', + value: '330903' + }, + { + city: '舟山市', + text: '岱山县', + value: '330921' + }, + { + city: '舟山市', + text: '嵊泗县', + value: '330922' + } + ], + '331000': [ + { + city: '台州市', + text: '市辖区', + value: '331001' + }, + { + city: '台州市', + text: '椒江区', + value: '331002' + }, + { + city: '台州市', + text: '黄岩区', + value: '331003' + }, + { + city: '台州市', + text: '路桥区', + value: '331004' + }, + { + city: '台州市', + text: '玉环县', + value: '331021' + }, + { + city: '台州市', + text: '三门县', + value: '331022' + }, + { + city: '台州市', + text: '天台县', + value: '331023' + }, + { + city: '台州市', + text: '仙居县', + value: '331024' + }, + { + city: '台州市', + text: '温岭市', + value: '331081' + }, + { + city: '台州市', + text: '临海市', + value: '331082' + } + ], + '331100': [ + { + city: '丽水市', + text: '市辖区', + value: '331101' + }, + { + city: '丽水市', + text: '莲都区', + value: '331102' + }, + { + city: '丽水市', + text: '青田县', + value: '331121' + }, + { + city: '丽水市', + text: '缙云县', + value: '331122' + }, + { + city: '丽水市', + text: '遂昌县', + value: '331123' + }, + { + city: '丽水市', + text: '松阳县', + value: '331124' + }, + { + city: '丽水市', + text: '云和县', + value: '331125' + }, + { + city: '丽水市', + text: '庆元县', + value: '331126' + }, + { + city: '丽水市', + text: '景宁畲族自治县', + value: '331127' + }, + { + city: '丽水市', + text: '龙泉市', + value: '331181' + } + ], + '340100': [ + { + city: '合肥市', + text: '市辖区', + value: '340101' + }, + { + city: '合肥市', + text: '瑶海区', + value: '340102' + }, + { + city: '合肥市', + text: '庐阳区', + value: '340103' + }, + { + city: '合肥市', + text: '蜀山区', + value: '340104' + }, + { + city: '合肥市', + text: '包河区', + value: '340111' + }, + { + city: '合肥市', + text: '长丰县', + value: '340121' + }, + { + city: '合肥市', + text: '肥东县', + value: '340122' + }, + { + city: '合肥市', + text: '肥西县', + value: '340123' + }, + { + city: '合肥市', + text: '庐江县', + value: '340124' + }, + { + city: '合肥市', + text: '巢湖市', + value: '340181' + } + ], + '340200': [ + { + city: '芜湖市', + text: '市辖区', + value: '340201' + }, + { + city: '芜湖市', + text: '镜湖区', + value: '340202' + }, + { + city: '芜湖市', + text: '弋江区', + value: '340203' + }, + { + city: '芜湖市', + text: '鸠江区', + value: '340207' + }, + { + city: '芜湖市', + text: '三山区', + value: '340208' + }, + { + city: '芜湖市', + text: '芜湖县', + value: '340221' + }, + { + city: '芜湖市', + text: '繁昌县', + value: '340222' + }, + { + city: '芜湖市', + text: '南陵县', + value: '340223' + }, + { + city: '芜湖市', + text: '无为县', + value: '340225' + } + ], + '340300': [ + { + city: '蚌埠市', + text: '市辖区', + value: '340301' + }, + { + city: '蚌埠市', + text: '龙子湖区', + value: '340302' + }, + { + city: '蚌埠市', + text: '蚌山区', + value: '340303' + }, + { + city: '蚌埠市', + text: '禹会区', + value: '340304' + }, + { + city: '蚌埠市', + text: '淮上区', + value: '340311' + }, + { + city: '蚌埠市', + text: '怀远县', + value: '340321' + }, + { + city: '蚌埠市', + text: '五河县', + value: '340322' + }, + { + city: '蚌埠市', + text: '固镇县', + value: '340323' + } + ], + '340400': [ + { + city: '淮南市', + text: '市辖区', + value: '340401' + }, + { + city: '淮南市', + text: '大通区', + value: '340402' + }, + { + city: '淮南市', + text: '田家庵区', + value: '340403' + }, + { + city: '淮南市', + text: '谢家集区', + value: '340404' + }, + { + city: '淮南市', + text: '八公山区', + value: '340405' + }, + { + city: '淮南市', + text: '潘集区', + value: '340406' + }, + { + city: '淮南市', + text: '凤台县', + value: '340421' + }, + { + city: '淮南市', + text: '寿县', + value: '340422' + } + ], + '340500': [ + { + city: '马鞍山市', + text: '市辖区', + value: '340501' + }, + { + city: '马鞍山市', + text: '花山区', + value: '340503' + }, + { + city: '马鞍山市', + text: '雨山区', + value: '340504' + }, + { + city: '马鞍山市', + text: '博望区', + value: '340506' + }, + { + city: '马鞍山市', + text: '当涂县', + value: '340521' + }, + { + city: '马鞍山市', + text: '含山县', + value: '340522' + }, + { + city: '马鞍山市', + text: '和县', + value: '340523' + } + ], + '340600': [ + { + city: '淮北市', + text: '市辖区', + value: '340601' + }, + { + city: '淮北市', + text: '杜集区', + value: '340602' + }, + { + city: '淮北市', + text: '相山区', + value: '340603' + }, + { + city: '淮北市', + text: '烈山区', + value: '340604' + }, + { + city: '淮北市', + text: '濉溪县', + value: '340621' + } + ], + '340700': [ + { + city: '铜陵市', + text: '市辖区', + value: '340701' + }, + { + city: '铜陵市', + text: '铜官区', + value: '340705' + }, + { + city: '铜陵市', + text: '义安区', + value: '340706' + }, + { + city: '铜陵市', + text: '郊区', + value: '340711' + }, + { + city: '铜陵市', + text: '枞阳县', + value: '340722' + } + ], + '340800': [ + { + city: '安庆市', + text: '市辖区', + value: '340801' + }, + { + city: '安庆市', + text: '迎江区', + value: '340802' + }, + { + city: '安庆市', + text: '大观区', + value: '340803' + }, + { + city: '安庆市', + text: '宜秀区', + value: '340811' + }, + { + city: '安庆市', + text: '怀宁县', + value: '340822' + }, + { + city: '安庆市', + text: '潜山县', + value: '340824' + }, + { + city: '安庆市', + text: '太湖县', + value: '340825' + }, + { + city: '安庆市', + text: '宿松县', + value: '340826' + }, + { + city: '安庆市', + text: '望江县', + value: '340827' + }, + { + city: '安庆市', + text: '岳西县', + value: '340828' + }, + { + city: '安庆市', + text: '桐城市', + value: '340881' + } + ], + '341000': [ + { + city: '黄山市', + text: '市辖区', + value: '341001' + }, + { + city: '黄山市', + text: '屯溪区', + value: '341002' + }, + { + city: '黄山市', + text: '黄山区', + value: '341003' + }, + { + city: '黄山市', + text: '徽州区', + value: '341004' + }, + { + city: '黄山市', + text: '歙县', + value: '341021' + }, + { + city: '黄山市', + text: '休宁县', + value: '341022' + }, + { + city: '黄山市', + text: '黟县', + value: '341023' + }, + { + city: '黄山市', + text: '祁门县', + value: '341024' + } + ], + '341100': [ + { + city: '滁州市', + text: '市辖区', + value: '341101' + }, + { + city: '滁州市', + text: '琅琊区', + value: '341102' + }, + { + city: '滁州市', + text: '南谯区', + value: '341103' + }, + { + city: '滁州市', + text: '来安县', + value: '341122' + }, + { + city: '滁州市', + text: '全椒县', + value: '341124' + }, + { + city: '滁州市', + text: '定远县', + value: '341125' + }, + { + city: '滁州市', + text: '凤阳县', + value: '341126' + }, + { + city: '滁州市', + text: '天长市', + value: '341181' + }, + { + city: '滁州市', + text: '明光市', + value: '341182' + } + ], + '341200': [ + { + city: '阜阳市', + text: '市辖区', + value: '341201' + }, + { + city: '阜阳市', + text: '颍州区', + value: '341202' + }, + { + city: '阜阳市', + text: '颍东区', + value: '341203' + }, + { + city: '阜阳市', + text: '颍泉区', + value: '341204' + }, + { + city: '阜阳市', + text: '临泉县', + value: '341221' + }, + { + city: '阜阳市', + text: '太和县', + value: '341222' + }, + { + city: '阜阳市', + text: '阜南县', + value: '341225' + }, + { + city: '阜阳市', + text: '颍上县', + value: '341226' + }, + { + city: '阜阳市', + text: '界首市', + value: '341282' + } + ], + '341300': [ + { + city: '宿州市', + text: '市辖区', + value: '341301' + }, + { + city: '宿州市', + text: '埇桥区', + value: '341302' + }, + { + city: '宿州市', + text: '砀山县', + value: '341321' + }, + { + city: '宿州市', + text: '萧县', + value: '341322' + }, + { + city: '宿州市', + text: '灵璧县', + value: '341323' + }, + { + city: '宿州市', + text: '泗县', + value: '341324' + } + ], + '341500': [ + { + city: '六安市', + text: '市辖区', + value: '341501' + }, + { + city: '六安市', + text: '金安区', + value: '341502' + }, + { + city: '六安市', + text: '裕安区', + value: '341503' + }, + { + city: '六安市', + text: '叶集区', + value: '341504' + }, + { + city: '六安市', + text: '霍邱县', + value: '341522' + }, + { + city: '六安市', + text: '舒城县', + value: '341523' + }, + { + city: '六安市', + text: '金寨县', + value: '341524' + }, + { + city: '六安市', + text: '霍山县', + value: '341525' + } + ], + '341600': [ + { + city: '亳州市', + text: '市辖区', + value: '341601' + }, + { + city: '亳州市', + text: '谯城区', + value: '341602' + }, + { + city: '亳州市', + text: '涡阳县', + value: '341621' + }, + { + city: '亳州市', + text: '蒙城县', + value: '341622' + }, + { + city: '亳州市', + text: '利辛县', + value: '341623' + } + ], + '341700': [ + { + city: '池州市', + text: '市辖区', + value: '341701' + }, + { + city: '池州市', + text: '贵池区', + value: '341702' + }, + { + city: '池州市', + text: '东至县', + value: '341721' + }, + { + city: '池州市', + text: '石台县', + value: '341722' + }, + { + city: '池州市', + text: '青阳县', + value: '341723' + } + ], + '341800': [ + { + city: '宣城市', + text: '市辖区', + value: '341801' + }, + { + city: '宣城市', + text: '宣州区', + value: '341802' + }, + { + city: '宣城市', + text: '郎溪县', + value: '341821' + }, + { + city: '宣城市', + text: '广德县', + value: '341822' + }, + { + city: '宣城市', + text: '泾县', + value: '341823' + }, + { + city: '宣城市', + text: '绩溪县', + value: '341824' + }, + { + city: '宣城市', + text: '旌德县', + value: '341825' + }, + { + city: '宣城市', + text: '宁国市', + value: '341881' + } + ], + '350100': [ + { + city: '福州市', + text: '市辖区', + value: '350101' + }, + { + city: '福州市', + text: '鼓楼区', + value: '350102' + }, + { + city: '福州市', + text: '台江区', + value: '350103' + }, + { + city: '福州市', + text: '仓山区', + value: '350104' + }, + { + city: '福州市', + text: '马尾区', + value: '350105' + }, + { + city: '福州市', + text: '晋安区', + value: '350111' + }, + { + city: '福州市', + text: '闽侯县', + value: '350121' + }, + { + city: '福州市', + text: '连江县', + value: '350122' + }, + { + city: '福州市', + text: '罗源县', + value: '350123' + }, + { + city: '福州市', + text: '闽清县', + value: '350124' + }, + { + city: '福州市', + text: '永泰县', + value: '350125' + }, + { + city: '福州市', + text: '平潭县', + value: '350128' + }, + { + city: '福州市', + text: '福清市', + value: '350181' + }, + { + city: '福州市', + text: '长乐市', + value: '350182' + } + ], + '350200': [ + { + city: '厦门市', + text: '市辖区', + value: '350201' + }, + { + city: '厦门市', + text: '思明区', + value: '350203' + }, + { + city: '厦门市', + text: '海沧区', + value: '350205' + }, + { + city: '厦门市', + text: '湖里区', + value: '350206' + }, + { + city: '厦门市', + text: '集美区', + value: '350211' + }, + { + city: '厦门市', + text: '同安区', + value: '350212' + }, + { + city: '厦门市', + text: '翔安区', + value: '350213' + } + ], + '350300': [ + { + city: '莆田市', + text: '市辖区', + value: '350301' + }, + { + city: '莆田市', + text: '城厢区', + value: '350302' + }, + { + city: '莆田市', + text: '涵江区', + value: '350303' + }, + { + city: '莆田市', + text: '荔城区', + value: '350304' + }, + { + city: '莆田市', + text: '秀屿区', + value: '350305' + }, + { + city: '莆田市', + text: '仙游县', + value: '350322' + } + ], + '350400': [ + { + city: '三明市', + text: '市辖区', + value: '350401' + }, + { + city: '三明市', + text: '梅列区', + value: '350402' + }, + { + city: '三明市', + text: '三元区', + value: '350403' + }, + { + city: '三明市', + text: '明溪县', + value: '350421' + }, + { + city: '三明市', + text: '清流县', + value: '350423' + }, + { + city: '三明市', + text: '宁化县', + value: '350424' + }, + { + city: '三明市', + text: '大田县', + value: '350425' + }, + { + city: '三明市', + text: '尤溪县', + value: '350426' + }, + { + city: '三明市', + text: '沙县', + value: '350427' + }, + { + city: '三明市', + text: '将乐县', + value: '350428' + }, + { + city: '三明市', + text: '泰宁县', + value: '350429' + }, + { + city: '三明市', + text: '建宁县', + value: '350430' + }, + { + city: '三明市', + text: '永安市', + value: '350481' + } + ], + '350500': [ + { + city: '泉州市', + text: '市辖区', + value: '350501' + }, + { + city: '泉州市', + text: '鲤城区', + value: '350502' + }, + { + city: '泉州市', + text: '丰泽区', + value: '350503' + }, + { + city: '泉州市', + text: '洛江区', + value: '350504' + }, + { + city: '泉州市', + text: '泉港区', + value: '350505' + }, + { + city: '泉州市', + text: '惠安县', + value: '350521' + }, + { + city: '泉州市', + text: '安溪县', + value: '350524' + }, + { + city: '泉州市', + text: '永春县', + value: '350525' + }, + { + city: '泉州市', + text: '德化县', + value: '350526' + }, + { + city: '泉州市', + text: '金门县', + value: '350527' + }, + { + city: '泉州市', + text: '石狮市', + value: '350581' + }, + { + city: '泉州市', + text: '晋江市', + value: '350582' + }, + { + city: '泉州市', + text: '南安市', + value: '350583' + } + ], + '350600': [ + { + city: '漳州市', + text: '市辖区', + value: '350601' + }, + { + city: '漳州市', + text: '芗城区', + value: '350602' + }, + { + city: '漳州市', + text: '龙文区', + value: '350603' + }, + { + city: '漳州市', + text: '云霄县', + value: '350622' + }, + { + city: '漳州市', + text: '漳浦县', + value: '350623' + }, + { + city: '漳州市', + text: '诏安县', + value: '350624' + }, + { + city: '漳州市', + text: '长泰县', + value: '350625' + }, + { + city: '漳州市', + text: '东山县', + value: '350626' + }, + { + city: '漳州市', + text: '南靖县', + value: '350627' + }, + { + city: '漳州市', + text: '平和县', + value: '350628' + }, + { + city: '漳州市', + text: '华安县', + value: '350629' + }, + { + city: '漳州市', + text: '龙海市', + value: '350681' + } + ], + '350700': [ + { + city: '南平市', + text: '市辖区', + value: '350701' + }, + { + city: '南平市', + text: '延平区', + value: '350702' + }, + { + city: '南平市', + text: '建阳区', + value: '350703' + }, + { + city: '南平市', + text: '顺昌县', + value: '350721' + }, + { + city: '南平市', + text: '浦城县', + value: '350722' + }, + { + city: '南平市', + text: '光泽县', + value: '350723' + }, + { + city: '南平市', + text: '松溪县', + value: '350724' + }, + { + city: '南平市', + text: '政和县', + value: '350725' + }, + { + city: '南平市', + text: '邵武市', + value: '350781' + }, + { + city: '南平市', + text: '武夷山市', + value: '350782' + }, + { + city: '南平市', + text: '建瓯市', + value: '350783' + } + ], + '350800': [ + { + city: '龙岩市', + text: '市辖区', + value: '350801' + }, + { + city: '龙岩市', + text: '新罗区', + value: '350802' + }, + { + city: '龙岩市', + text: '永定区', + value: '350803' + }, + { + city: '龙岩市', + text: '长汀县', + value: '350821' + }, + { + city: '龙岩市', + text: '上杭县', + value: '350823' + }, + { + city: '龙岩市', + text: '武平县', + value: '350824' + }, + { + city: '龙岩市', + text: '连城县', + value: '350825' + }, + { + city: '龙岩市', + text: '漳平市', + value: '350881' + } + ], + '350900': [ + { + city: '宁德市', + text: '市辖区', + value: '350901' + }, + { + city: '宁德市', + text: '蕉城区', + value: '350902' + }, + { + city: '宁德市', + text: '霞浦县', + value: '350921' + }, + { + city: '宁德市', + text: '古田县', + value: '350922' + }, + { + city: '宁德市', + text: '屏南县', + value: '350923' + }, + { + city: '宁德市', + text: '寿宁县', + value: '350924' + }, + { + city: '宁德市', + text: '周宁县', + value: '350925' + }, + { + city: '宁德市', + text: '柘荣县', + value: '350926' + }, + { + city: '宁德市', + text: '福安市', + value: '350981' + }, + { + city: '宁德市', + text: '福鼎市', + value: '350982' + } + ], + '360100': [ + { + city: '南昌市', + text: '市辖区', + value: '360101' + }, + { + city: '南昌市', + text: '东湖区', + value: '360102' + }, + { + city: '南昌市', + text: '西湖区', + value: '360103' + }, + { + city: '南昌市', + text: '青云谱区', + value: '360104' + }, + { + city: '南昌市', + text: '湾里区', + value: '360105' + }, + { + city: '南昌市', + text: '青山湖区', + value: '360111' + }, + { + city: '南昌市', + text: '新建区', + value: '360112' + }, + { + city: '南昌市', + text: '南昌县', + value: '360121' + }, + { + city: '南昌市', + text: '安义县', + value: '360123' + }, + { + city: '南昌市', + text: '进贤县', + value: '360124' + } + ], + '360200': [ + { + city: '景德镇市', + text: '市辖区', + value: '360201' + }, + { + city: '景德镇市', + text: '昌江区', + value: '360202' + }, + { + city: '景德镇市', + text: '珠山区', + value: '360203' + }, + { + city: '景德镇市', + text: '浮梁县', + value: '360222' + }, + { + city: '景德镇市', + text: '乐平市', + value: '360281' + } + ], + '360300': [ + { + city: '萍乡市', + text: '市辖区', + value: '360301' + }, + { + city: '萍乡市', + text: '安源区', + value: '360302' + }, + { + city: '萍乡市', + text: '湘东区', + value: '360313' + }, + { + city: '萍乡市', + text: '莲花县', + value: '360321' + }, + { + city: '萍乡市', + text: '上栗县', + value: '360322' + }, + { + city: '萍乡市', + text: '芦溪县', + value: '360323' + } + ], + '360400': [ + { + city: '九江市', + text: '市辖区', + value: '360401' + }, + { + city: '九江市', + text: '濂溪区', + value: '360402' + }, + { + city: '九江市', + text: '浔阳区', + value: '360403' + }, + { + city: '九江市', + text: '九江县', + value: '360421' + }, + { + city: '九江市', + text: '武宁县', + value: '360423' + }, + { + city: '九江市', + text: '修水县', + value: '360424' + }, + { + city: '九江市', + text: '永修县', + value: '360425' + }, + { + city: '九江市', + text: '德安县', + value: '360426' + }, + { + city: '九江市', + text: '都昌县', + value: '360428' + }, + { + city: '九江市', + text: '湖口县', + value: '360429' + }, + { + city: '九江市', + text: '彭泽县', + value: '360430' + }, + { + city: '九江市', + text: '瑞昌市', + value: '360481' + }, + { + city: '九江市', + text: '共青城市', + value: '360482' + }, + { + city: '九江市', + text: '庐山市', + value: '360483' + } + ], + '360500': [ + { + city: '新余市', + text: '市辖区', + value: '360501' + }, + { + city: '新余市', + text: '渝水区', + value: '360502' + }, + { + city: '新余市', + text: '分宜县', + value: '360521' + } + ], + '360600': [ + { + city: '鹰潭市', + text: '市辖区', + value: '360601' + }, + { + city: '鹰潭市', + text: '月湖区', + value: '360602' + }, + { + city: '鹰潭市', + text: '余江县', + value: '360622' + }, + { + city: '鹰潭市', + text: '贵溪市', + value: '360681' + } + ], + '360700': [ + { + city: '赣州市', + text: '市辖区', + value: '360701' + }, + { + city: '赣州市', + text: '章贡区', + value: '360702' + }, + { + city: '赣州市', + text: '南康区', + value: '360703' + }, + { + city: '赣州市', + text: '赣县', + value: '360721' + }, + { + city: '赣州市', + text: '信丰县', + value: '360722' + }, + { + city: '赣州市', + text: '大余县', + value: '360723' + }, + { + city: '赣州市', + text: '上犹县', + value: '360724' + }, + { + city: '赣州市', + text: '崇义县', + value: '360725' + }, + { + city: '赣州市', + text: '安远县', + value: '360726' + }, + { + city: '赣州市', + text: '龙南县', + value: '360727' + }, + { + city: '赣州市', + text: '定南县', + value: '360728' + }, + { + city: '赣州市', + text: '全南县', + value: '360729' + }, + { + city: '赣州市', + text: '宁都县', + value: '360730' + }, + { + city: '赣州市', + text: '于都县', + value: '360731' + }, + { + city: '赣州市', + text: '兴国县', + value: '360732' + }, + { + city: '赣州市', + text: '会昌县', + value: '360733' + }, + { + city: '赣州市', + text: '寻乌县', + value: '360734' + }, + { + city: '赣州市', + text: '石城县', + value: '360735' + }, + { + city: '赣州市', + text: '瑞金市', + value: '360781' + } + ], + '360800': [ + { + city: '吉安市', + text: '市辖区', + value: '360801' + }, + { + city: '吉安市', + text: '吉州区', + value: '360802' + }, + { + city: '吉安市', + text: '青原区', + value: '360803' + }, + { + city: '吉安市', + text: '吉安县', + value: '360821' + }, + { + city: '吉安市', + text: '吉水县', + value: '360822' + }, + { + city: '吉安市', + text: '峡江县', + value: '360823' + }, + { + city: '吉安市', + text: '新干县', + value: '360824' + }, + { + city: '吉安市', + text: '永丰县', + value: '360825' + }, + { + city: '吉安市', + text: '泰和县', + value: '360826' + }, + { + city: '吉安市', + text: '遂川县', + value: '360827' + }, + { + city: '吉安市', + text: '万安县', + value: '360828' + }, + { + city: '吉安市', + text: '安福县', + value: '360829' + }, + { + city: '吉安市', + text: '永新县', + value: '360830' + }, + { + city: '吉安市', + text: '井冈山市', + value: '360881' + } + ], + '360900': [ + { + city: '宜春市', + text: '市辖区', + value: '360901' + }, + { + city: '宜春市', + text: '袁州区', + value: '360902' + }, + { + city: '宜春市', + text: '奉新县', + value: '360921' + }, + { + city: '宜春市', + text: '万载县', + value: '360922' + }, + { + city: '宜春市', + text: '上高县', + value: '360923' + }, + { + city: '宜春市', + text: '宜丰县', + value: '360924' + }, + { + city: '宜春市', + text: '靖安县', + value: '360925' + }, + { + city: '宜春市', + text: '铜鼓县', + value: '360926' + }, + { + city: '宜春市', + text: '丰城市', + value: '360981' + }, + { + city: '宜春市', + text: '樟树市', + value: '360982' + }, + { + city: '宜春市', + text: '高安市', + value: '360983' + } + ], + '361000': [ + { + city: '抚州市', + text: '市辖区', + value: '361001' + }, + { + city: '抚州市', + text: '临川区', + value: '361002' + }, + { + city: '抚州市', + text: '南城县', + value: '361021' + }, + { + city: '抚州市', + text: '黎川县', + value: '361022' + }, + { + city: '抚州市', + text: '南丰县', + value: '361023' + }, + { + city: '抚州市', + text: '崇仁县', + value: '361024' + }, + { + city: '抚州市', + text: '乐安县', + value: '361025' + }, + { + city: '抚州市', + text: '宜黄县', + value: '361026' + }, + { + city: '抚州市', + text: '金溪县', + value: '361027' + }, + { + city: '抚州市', + text: '资溪县', + value: '361028' + }, + { + city: '抚州市', + text: '东乡县', + value: '361029' + }, + { + city: '抚州市', + text: '广昌县', + value: '361030' + } + ], + '361100': [ + { + city: '上饶市', + text: '市辖区', + value: '361101' + }, + { + city: '上饶市', + text: '信州区', + value: '361102' + }, + { + city: '上饶市', + text: '广丰区', + value: '361103' + }, + { + city: '上饶市', + text: '上饶县', + value: '361121' + }, + { + city: '上饶市', + text: '玉山县', + value: '361123' + }, + { + city: '上饶市', + text: '铅山县', + value: '361124' + }, + { + city: '上饶市', + text: '横峰县', + value: '361125' + }, + { + city: '上饶市', + text: '弋阳县', + value: '361126' + }, + { + city: '上饶市', + text: '余干县', + value: '361127' + }, + { + city: '上饶市', + text: '鄱阳县', + value: '361128' + }, + { + city: '上饶市', + text: '万年县', + value: '361129' + }, + { + city: '上饶市', + text: '婺源县', + value: '361130' + }, + { + city: '上饶市', + text: '德兴市', + value: '361181' + } + ], + '370100': [ + { + city: '济南市', + text: '市辖区', + value: '370101' + }, + { + city: '济南市', + text: '历下区', + value: '370102' + }, + { + city: '济南市', + text: '市中区', + value: '370103' + }, + { + city: '济南市', + text: '槐荫区', + value: '370104' + }, + { + city: '济南市', + text: '天桥区', + value: '370105' + }, + { + city: '济南市', + text: '历城区', + value: '370112' + }, + { + city: '济南市', + text: '长清区', + value: '370113' + }, + { + city: '济南市', + text: '平阴县', + value: '370124' + }, + { + city: '济南市', + text: '济阳县', + value: '370125' + }, + { + city: '济南市', + text: '商河县', + value: '370126' + }, + { + city: '济南市', + text: '章丘市', + value: '370181' + } + ], + '370200': [ + { + city: '青岛市', + text: '市辖区', + value: '370201' + }, + { + city: '青岛市', + text: '市南区', + value: '370202' + }, + { + city: '青岛市', + text: '市北区', + value: '370203' + }, + { + city: '青岛市', + text: '黄岛区', + value: '370211' + }, + { + city: '青岛市', + text: '崂山区', + value: '370212' + }, + { + city: '青岛市', + text: '李沧区', + value: '370213' + }, + { + city: '青岛市', + text: '城阳区', + value: '370214' + }, + { + city: '青岛市', + text: '胶州市', + value: '370281' + }, + { + city: '青岛市', + text: '即墨市', + value: '370282' + }, + { + city: '青岛市', + text: '平度市', + value: '370283' + }, + { + city: '青岛市', + text: '莱西市', + value: '370285' + } + ], + '370300': [ + { + city: '淄博市', + text: '市辖区', + value: '370301' + }, + { + city: '淄博市', + text: '淄川区', + value: '370302' + }, + { + city: '淄博市', + text: '张店区', + value: '370303' + }, + { + city: '淄博市', + text: '博山区', + value: '370304' + }, + { + city: '淄博市', + text: '临淄区', + value: '370305' + }, + { + city: '淄博市', + text: '周村区', + value: '370306' + }, + { + city: '淄博市', + text: '桓台县', + value: '370321' + }, + { + city: '淄博市', + text: '高青县', + value: '370322' + }, + { + city: '淄博市', + text: '沂源县', + value: '370323' + } + ], + '370400': [ + { + city: '枣庄市', + text: '市辖区', + value: '370401' + }, + { + city: '枣庄市', + text: '市中区', + value: '370402' + }, + { + city: '枣庄市', + text: '薛城区', + value: '370403' + }, + { + city: '枣庄市', + text: '峄城区', + value: '370404' + }, + { + city: '枣庄市', + text: '台儿庄区', + value: '370405' + }, + { + city: '枣庄市', + text: '山亭区', + value: '370406' + }, + { + city: '枣庄市', + text: '滕州市', + value: '370481' + } + ], + '370500': [ + { + city: '东营市', + text: '市辖区', + value: '370501' + }, + { + city: '东营市', + text: '东营区', + value: '370502' + }, + { + city: '东营市', + text: '河口区', + value: '370503' + }, + { + city: '东营市', + text: '垦利区', + value: '370505' + }, + { + city: '东营市', + text: '利津县', + value: '370522' + }, + { + city: '东营市', + text: '广饶县', + value: '370523' + } + ], + '370600': [ + { + city: '烟台市', + text: '市辖区', + value: '370601' + }, + { + city: '烟台市', + text: '芝罘区', + value: '370602' + }, + { + city: '烟台市', + text: '福山区', + value: '370611' + }, + { + city: '烟台市', + text: '牟平区', + value: '370612' + }, + { + city: '烟台市', + text: '莱山区', + value: '370613' + }, + { + city: '烟台市', + text: '长岛县', + value: '370634' + }, + { + city: '烟台市', + text: '龙口市', + value: '370681' + }, + { + city: '烟台市', + text: '莱阳市', + value: '370682' + }, + { + city: '烟台市', + text: '莱州市', + value: '370683' + }, + { + city: '烟台市', + text: '蓬莱市', + value: '370684' + }, + { + city: '烟台市', + text: '招远市', + value: '370685' + }, + { + city: '烟台市', + text: '栖霞市', + value: '370686' + }, + { + city: '烟台市', + text: '海阳市', + value: '370687' + } + ], + '370700': [ + { + city: '潍坊市', + text: '市辖区', + value: '370701' + }, + { + city: '潍坊市', + text: '潍城区', + value: '370702' + }, + { + city: '潍坊市', + text: '寒亭区', + value: '370703' + }, + { + city: '潍坊市', + text: '坊子区', + value: '370704' + }, + { + city: '潍坊市', + text: '奎文区', + value: '370705' + }, + { + city: '潍坊市', + text: '临朐县', + value: '370724' + }, + { + city: '潍坊市', + text: '昌乐县', + value: '370725' + }, + { + city: '潍坊市', + text: '青州市', + value: '370781' + }, + { + city: '潍坊市', + text: '诸城市', + value: '370782' + }, + { + city: '潍坊市', + text: '寿光市', + value: '370783' + }, + { + city: '潍坊市', + text: '安丘市', + value: '370784' + }, + { + city: '潍坊市', + text: '高密市', + value: '370785' + }, + { + city: '潍坊市', + text: '昌邑市', + value: '370786' + } + ], + '370800': [ + { + city: '济宁市', + text: '市辖区', + value: '370801' + }, + { + city: '济宁市', + text: '任城区', + value: '370811' + }, + { + city: '济宁市', + text: '兖州区', + value: '370812' + }, + { + city: '济宁市', + text: '微山县', + value: '370826' + }, + { + city: '济宁市', + text: '鱼台县', + value: '370827' + }, + { + city: '济宁市', + text: '金乡县', + value: '370828' + }, + { + city: '济宁市', + text: '嘉祥县', + value: '370829' + }, + { + city: '济宁市', + text: '汶上县', + value: '370830' + }, + { + city: '济宁市', + text: '泗水县', + value: '370831' + }, + { + city: '济宁市', + text: '梁山县', + value: '370832' + }, + { + city: '济宁市', + text: '曲阜市', + value: '370881' + }, + { + city: '济宁市', + text: '邹城市', + value: '370883' + } + ], + '370900': [ + { + city: '泰安市', + text: '市辖区', + value: '370901' + }, + { + city: '泰安市', + text: '泰山区', + value: '370902' + }, + { + city: '泰安市', + text: '岱岳区', + value: '370911' + }, + { + city: '泰安市', + text: '宁阳县', + value: '370921' + }, + { + city: '泰安市', + text: '东平县', + value: '370923' + }, + { + city: '泰安市', + text: '新泰市', + value: '370982' + }, + { + city: '泰安市', + text: '肥城市', + value: '370983' + } + ], + '371000': [ + { + city: '威海市', + text: '市辖区', + value: '371001' + }, + { + city: '威海市', + text: '环翠区', + value: '371002' + }, + { + city: '威海市', + text: '文登区', + value: '371003' + }, + { + city: '威海市', + text: '荣成市', + value: '371082' + }, + { + city: '威海市', + text: '乳山市', + value: '371083' + } + ], + '371100': [ + { + city: '日照市', + text: '市辖区', + value: '371101' + }, + { + city: '日照市', + text: '东港区', + value: '371102' + }, + { + city: '日照市', + text: '岚山区', + value: '371103' + }, + { + city: '日照市', + text: '五莲县', + value: '371121' + }, + { + city: '日照市', + text: '莒县', + value: '371122' + } + ], + '371200': [ + { + city: '莱芜市', + text: '市辖区', + value: '371201' + }, + { + city: '莱芜市', + text: '莱城区', + value: '371202' + }, + { + city: '莱芜市', + text: '钢城区', + value: '371203' + } + ], + '371300': [ + { + city: '临沂市', + text: '市辖区', + value: '371301' + }, + { + city: '临沂市', + text: '兰山区', + value: '371302' + }, + { + city: '临沂市', + text: '罗庄区', + value: '371311' + }, + { + city: '临沂市', + text: '河东区', + value: '371312' + }, + { + city: '临沂市', + text: '沂南县', + value: '371321' + }, + { + city: '临沂市', + text: '郯城县', + value: '371322' + }, + { + city: '临沂市', + text: '沂水县', + value: '371323' + }, + { + city: '临沂市', + text: '兰陵县', + value: '371324' + }, + { + city: '临沂市', + text: '费县', + value: '371325' + }, + { + city: '临沂市', + text: '平邑县', + value: '371326' + }, + { + city: '临沂市', + text: '莒南县', + value: '371327' + }, + { + city: '临沂市', + text: '蒙阴县', + value: '371328' + }, + { + city: '临沂市', + text: '临沭县', + value: '371329' + } + ], + '371400': [ + { + city: '德州市', + text: '市辖区', + value: '371401' + }, + { + city: '德州市', + text: '德城区', + value: '371402' + }, + { + city: '德州市', + text: '陵城区', + value: '371403' + }, + { + city: '德州市', + text: '宁津县', + value: '371422' + }, + { + city: '德州市', + text: '庆云县', + value: '371423' + }, + { + city: '德州市', + text: '临邑县', + value: '371424' + }, + { + city: '德州市', + text: '齐河县', + value: '371425' + }, + { + city: '德州市', + text: '平原县', + value: '371426' + }, + { + city: '德州市', + text: '夏津县', + value: '371427' + }, + { + city: '德州市', + text: '武城县', + value: '371428' + }, + { + city: '德州市', + text: '乐陵市', + value: '371481' + }, + { + city: '德州市', + text: '禹城市', + value: '371482' + } + ], + '371500': [ + { + city: '聊城市', + text: '市辖区', + value: '371501' + }, + { + city: '聊城市', + text: '东昌府区', + value: '371502' + }, + { + city: '聊城市', + text: '阳谷县', + value: '371521' + }, + { + city: '聊城市', + text: '莘县', + value: '371522' + }, + { + city: '聊城市', + text: '茌平县', + value: '371523' + }, + { + city: '聊城市', + text: '东阿县', + value: '371524' + }, + { + city: '聊城市', + text: '冠县', + value: '371525' + }, + { + city: '聊城市', + text: '高唐县', + value: '371526' + }, + { + city: '聊城市', + text: '临清市', + value: '371581' + } + ], + '371600': [ + { + city: '滨州市', + text: '市辖区', + value: '371601' + }, + { + city: '滨州市', + text: '滨城区', + value: '371602' + }, + { + city: '滨州市', + text: '沾化区', + value: '371603' + }, + { + city: '滨州市', + text: '惠民县', + value: '371621' + }, + { + city: '滨州市', + text: '阳信县', + value: '371622' + }, + { + city: '滨州市', + text: '无棣县', + value: '371623' + }, + { + city: '滨州市', + text: '博兴县', + value: '371625' + }, + { + city: '滨州市', + text: '邹平县', + value: '371626' + } + ], + '371700': [ + { + city: '菏泽市', + text: '市辖区', + value: '371701' + }, + { + city: '菏泽市', + text: '牡丹区', + value: '371702' + }, + { + city: '菏泽市', + text: '定陶区', + value: '371703' + }, + { + city: '菏泽市', + text: '曹县', + value: '371721' + }, + { + city: '菏泽市', + text: '单县', + value: '371722' + }, + { + city: '菏泽市', + text: '成武县', + value: '371723' + }, + { + city: '菏泽市', + text: '巨野县', + value: '371724' + }, + { + city: '菏泽市', + text: '郓城县', + value: '371725' + }, + { + city: '菏泽市', + text: '鄄城县', + value: '371726' + }, + { + city: '菏泽市', + text: '东明县', + value: '371728' + } + ], + '410100': [ + { + city: '郑州市', + text: '市辖区', + value: '410101' + }, + { + city: '郑州市', + text: '中原区', + value: '410102' + }, + { + city: '郑州市', + text: '二七区', + value: '410103' + }, + { + city: '郑州市', + text: '管城回族区', + value: '410104' + }, + { + city: '郑州市', + text: '金水区', + value: '410105' + }, + { + city: '郑州市', + text: '上街区', + value: '410106' + }, + { + city: '郑州市', + text: '惠济区', + value: '410108' + }, + { + city: '郑州市', + text: '中牟县', + value: '410122' + }, + { + city: '郑州市', + text: '巩义市', + value: '410181' + }, + { + city: '郑州市', + text: '荥阳市', + value: '410182' + }, + { + city: '郑州市', + text: '新密市', + value: '410183' + }, + { + city: '郑州市', + text: '新郑市', + value: '410184' + }, + { + city: '郑州市', + text: '登封市', + value: '410185' + } + ], + '410200': [ + { + city: '开封市', + text: '市辖区', + value: '410201' + }, + { + city: '开封市', + text: '龙亭区', + value: '410202' + }, + { + city: '开封市', + text: '顺河回族区', + value: '410203' + }, + { + city: '开封市', + text: '鼓楼区', + value: '410204' + }, + { + city: '开封市', + text: '禹王台区', + value: '410205' + }, + { + city: '开封市', + text: '金明区', + value: '410211' + }, + { + city: '开封市', + text: '祥符区', + value: '410212' + }, + { + city: '开封市', + text: '杞县', + value: '410221' + }, + { + city: '开封市', + text: '通许县', + value: '410222' + }, + { + city: '开封市', + text: '尉氏县', + value: '410223' + }, + { + city: '开封市', + text: '兰考县', + value: '410225' + } + ], + '410300': [ + { + city: '洛阳市', + text: '市辖区', + value: '410301' + }, + { + city: '洛阳市', + text: '老城区', + value: '410302' + }, + { + city: '洛阳市', + text: '西工区', + value: '410303' + }, + { + city: '洛阳市', + text: '瀍河回族区', + value: '410304' + }, + { + city: '洛阳市', + text: '涧西区', + value: '410305' + }, + { + city: '洛阳市', + text: '吉利区', + value: '410306' + }, + { + city: '洛阳市', + text: '洛龙区', + value: '410311' + }, + { + city: '洛阳市', + text: '孟津县', + value: '410322' + }, + { + city: '洛阳市', + text: '新安县', + value: '410323' + }, + { + city: '洛阳市', + text: '栾川县', + value: '410324' + }, + { + city: '洛阳市', + text: '嵩县', + value: '410325' + }, + { + city: '洛阳市', + text: '汝阳县', + value: '410326' + }, + { + city: '洛阳市', + text: '宜阳县', + value: '410327' + }, + { + city: '洛阳市', + text: '洛宁县', + value: '410328' + }, + { + city: '洛阳市', + text: '伊川县', + value: '410329' + }, + { + city: '洛阳市', + text: '偃师市', + value: '410381' + } + ], + '410400': [ + { + city: '平顶山市', + text: '市辖区', + value: '410401' + }, + { + city: '平顶山市', + text: '新华区', + value: '410402' + }, + { + city: '平顶山市', + text: '卫东区', + value: '410403' + }, + { + city: '平顶山市', + text: '石龙区', + value: '410404' + }, + { + city: '平顶山市', + text: '湛河区', + value: '410411' + }, + { + city: '平顶山市', + text: '宝丰县', + value: '410421' + }, + { + city: '平顶山市', + text: '叶县', + value: '410422' + }, + { + city: '平顶山市', + text: '鲁山县', + value: '410423' + }, + { + city: '平顶山市', + text: '郏县', + value: '410425' + }, + { + city: '平顶山市', + text: '舞钢市', + value: '410481' + }, + { + city: '平顶山市', + text: '汝州市', + value: '410482' + } + ], + '410500': [ + { + city: '安阳市', + text: '市辖区', + value: '410501' + }, + { + city: '安阳市', + text: '文峰区', + value: '410502' + }, + { + city: '安阳市', + text: '北关区', + value: '410503' + }, + { + city: '安阳市', + text: '殷都区', + value: '410505' + }, + { + city: '安阳市', + text: '龙安区', + value: '410506' + }, + { + city: '安阳市', + text: '安阳县', + value: '410522' + }, + { + city: '安阳市', + text: '汤阴县', + value: '410523' + }, + { + city: '安阳市', + text: '滑县', + value: '410526' + }, + { + city: '安阳市', + text: '内黄县', + value: '410527' + }, + { + city: '安阳市', + text: '林州市', + value: '410581' + } + ], + '410600': [ + { + city: '鹤壁市', + text: '市辖区', + value: '410601' + }, + { + city: '鹤壁市', + text: '鹤山区', + value: '410602' + }, + { + city: '鹤壁市', + text: '山城区', + value: '410603' + }, + { + city: '鹤壁市', + text: '淇滨区', + value: '410611' + }, + { + city: '鹤壁市', + text: '浚县', + value: '410621' + }, + { + city: '鹤壁市', + text: '淇县', + value: '410622' + } + ], + '410700': [ + { + city: '新乡市', + text: '市辖区', + value: '410701' + }, + { + city: '新乡市', + text: '红旗区', + value: '410702' + }, + { + city: '新乡市', + text: '卫滨区', + value: '410703' + }, + { + city: '新乡市', + text: '凤泉区', + value: '410704' + }, + { + city: '新乡市', + text: '牧野区', + value: '410711' + }, + { + city: '新乡市', + text: '新乡县', + value: '410721' + }, + { + city: '新乡市', + text: '获嘉县', + value: '410724' + }, + { + city: '新乡市', + text: '原阳县', + value: '410725' + }, + { + city: '新乡市', + text: '延津县', + value: '410726' + }, + { + city: '新乡市', + text: '封丘县', + value: '410727' + }, + { + city: '新乡市', + text: '长垣县', + value: '410728' + }, + { + city: '新乡市', + text: '卫辉市', + value: '410781' + }, + { + city: '新乡市', + text: '辉县市', + value: '410782' + } + ], + '410800': [ + { + city: '焦作市', + text: '市辖区', + value: '410801' + }, + { + city: '焦作市', + text: '解放区', + value: '410802' + }, + { + city: '焦作市', + text: '中站区', + value: '410803' + }, + { + city: '焦作市', + text: '马村区', + value: '410804' + }, + { + city: '焦作市', + text: '山阳区', + value: '410811' + }, + { + city: '焦作市', + text: '修武县', + value: '410821' + }, + { + city: '焦作市', + text: '博爱县', + value: '410822' + }, + { + city: '焦作市', + text: '武陟县', + value: '410823' + }, + { + city: '焦作市', + text: '温县', + value: '410825' + }, + { + city: '焦作市', + text: '沁阳市', + value: '410882' + }, + { + city: '焦作市', + text: '孟州市', + value: '410883' + } + ], + '410900': [ + { + city: '濮阳市', + text: '市辖区', + value: '410901' + }, + { + city: '濮阳市', + text: '华龙区', + value: '410902' + }, + { + city: '濮阳市', + text: '清丰县', + value: '410922' + }, + { + city: '濮阳市', + text: '南乐县', + value: '410923' + }, + { + city: '濮阳市', + text: '范县', + value: '410926' + }, + { + city: '濮阳市', + text: '台前县', + value: '410927' + }, + { + city: '濮阳市', + text: '濮阳县', + value: '410928' + } + ], + '411000': [ + { + city: '许昌市', + text: '市辖区', + value: '411001' + }, + { + city: '许昌市', + text: '魏都区', + value: '411002' + }, + { + city: '许昌市', + text: '许昌县', + value: '411023' + }, + { + city: '许昌市', + text: '鄢陵县', + value: '411024' + }, + { + city: '许昌市', + text: '襄城县', + value: '411025' + }, + { + city: '许昌市', + text: '禹州市', + value: '411081' + }, + { + city: '许昌市', + text: '长葛市', + value: '411082' + } + ], + '411100': [ + { + city: '漯河市', + text: '市辖区', + value: '411101' + }, + { + city: '漯河市', + text: '源汇区', + value: '411102' + }, + { + city: '漯河市', + text: '郾城区', + value: '411103' + }, + { + city: '漯河市', + text: '召陵区', + value: '411104' + }, + { + city: '漯河市', + text: '舞阳县', + value: '411121' + }, + { + city: '漯河市', + text: '临颍县', + value: '411122' + } + ], + '411200': [ + { + city: '三门峡市', + text: '市辖区', + value: '411201' + }, + { + city: '三门峡市', + text: '湖滨区', + value: '411202' + }, + { + city: '三门峡市', + text: '陕州区', + value: '411203' + }, + { + city: '三门峡市', + text: '渑池县', + value: '411221' + }, + { + city: '三门峡市', + text: '卢氏县', + value: '411224' + }, + { + city: '三门峡市', + text: '义马市', + value: '411281' + }, + { + city: '三门峡市', + text: '灵宝市', + value: '411282' + } + ], + '411300': [ + { + city: '南阳市', + text: '市辖区', + value: '411301' + }, + { + city: '南阳市', + text: '宛城区', + value: '411302' + }, + { + city: '南阳市', + text: '卧龙区', + value: '411303' + }, + { + city: '南阳市', + text: '南召县', + value: '411321' + }, + { + city: '南阳市', + text: '方城县', + value: '411322' + }, + { + city: '南阳市', + text: '西峡县', + value: '411323' + }, + { + city: '南阳市', + text: '镇平县', + value: '411324' + }, + { + city: '南阳市', + text: '内乡县', + value: '411325' + }, + { + city: '南阳市', + text: '淅川县', + value: '411326' + }, + { + city: '南阳市', + text: '社旗县', + value: '411327' + }, + { + city: '南阳市', + text: '唐河县', + value: '411328' + }, + { + city: '南阳市', + text: '新野县', + value: '411329' + }, + { + city: '南阳市', + text: '桐柏县', + value: '411330' + }, + { + city: '南阳市', + text: '邓州市', + value: '411381' + } + ], + '411400': [ + { + city: '商丘市', + text: '市辖区', + value: '411401' + }, + { + city: '商丘市', + text: '梁园区', + value: '411402' + }, + { + city: '商丘市', + text: '睢阳区', + value: '411403' + }, + { + city: '商丘市', + text: '民权县', + value: '411421' + }, + { + city: '商丘市', + text: '睢县', + value: '411422' + }, + { + city: '商丘市', + text: '宁陵县', + value: '411423' + }, + { + city: '商丘市', + text: '柘城县', + value: '411424' + }, + { + city: '商丘市', + text: '虞城县', + value: '411425' + }, + { + city: '商丘市', + text: '夏邑县', + value: '411426' + }, + { + city: '商丘市', + text: '永城市', + value: '411481' + } + ], + '411500': [ + { + city: '信阳市', + text: '市辖区', + value: '411501' + }, + { + city: '信阳市', + text: '浉河区', + value: '411502' + }, + { + city: '信阳市', + text: '平桥区', + value: '411503' + }, + { + city: '信阳市', + text: '罗山县', + value: '411521' + }, + { + city: '信阳市', + text: '光山县', + value: '411522' + }, + { + city: '信阳市', + text: '新县', + value: '411523' + }, + { + city: '信阳市', + text: '商城县', + value: '411524' + }, + { + city: '信阳市', + text: '固始县', + value: '411525' + }, + { + city: '信阳市', + text: '潢川县', + value: '411526' + }, + { + city: '信阳市', + text: '淮滨县', + value: '411527' + }, + { + city: '信阳市', + text: '息县', + value: '411528' + } + ], + '411600': [ + { + city: '周口市', + text: '市辖区', + value: '411601' + }, + { + city: '周口市', + text: '川汇区', + value: '411602' + }, + { + city: '周口市', + text: '扶沟县', + value: '411621' + }, + { + city: '周口市', + text: '西华县', + value: '411622' + }, + { + city: '周口市', + text: '商水县', + value: '411623' + }, + { + city: '周口市', + text: '沈丘县', + value: '411624' + }, + { + city: '周口市', + text: '郸城县', + value: '411625' + }, + { + city: '周口市', + text: '淮阳县', + value: '411626' + }, + { + city: '周口市', + text: '太康县', + value: '411627' + }, + { + city: '周口市', + text: '鹿邑县', + value: '411628' + }, + { + city: '周口市', + text: '项城市', + value: '411681' + } + ], + '411700': [ + { + city: '驻马店市', + text: '市辖区', + value: '411701' + }, + { + city: '驻马店市', + text: '驿城区', + value: '411702' + }, + { + city: '驻马店市', + text: '西平县', + value: '411721' + }, + { + city: '驻马店市', + text: '上蔡县', + value: '411722' + }, + { + city: '驻马店市', + text: '平舆县', + value: '411723' + }, + { + city: '驻马店市', + text: '正阳县', + value: '411724' + }, + { + city: '驻马店市', + text: '确山县', + value: '411725' + }, + { + city: '驻马店市', + text: '泌阳县', + value: '411726' + }, + { + city: '驻马店市', + text: '汝南县', + value: '411727' + }, + { + city: '驻马店市', + text: '遂平县', + value: '411728' + }, + { + city: '驻马店市', + text: '新蔡县', + value: '411729' + } + ], + '419000': [ + { + city: '省直辖县级行政区划', + text: '济源市', + value: '419001' + } + ], + '420100': [ + { + city: '武汉市', + text: '市辖区', + value: '420101' + }, + { + city: '武汉市', + text: '江岸区', + value: '420102' + }, + { + city: '武汉市', + text: '江汉区', + value: '420103' + }, + { + city: '武汉市', + text: '硚口区', + value: '420104' + }, + { + city: '武汉市', + text: '汉阳区', + value: '420105' + }, + { + city: '武汉市', + text: '武昌区', + value: '420106' + }, + { + city: '武汉市', + text: '青山区', + value: '420107' + }, + { + city: '武汉市', + text: '洪山区', + value: '420111' + }, + { + city: '武汉市', + text: '东西湖区', + value: '420112' + }, + { + city: '武汉市', + text: '汉南区', + value: '420113' + }, + { + city: '武汉市', + text: '蔡甸区', + value: '420114' + }, + { + city: '武汉市', + text: '江夏区', + value: '420115' + }, + { + city: '武汉市', + text: '黄陂区', + value: '420116' + }, + { + city: '武汉市', + text: '新洲区', + value: '420117' + } + ], + '420200': [ + { + city: '黄石市', + text: '市辖区', + value: '420201' + }, + { + city: '黄石市', + text: '黄石港区', + value: '420202' + }, + { + city: '黄石市', + text: '西塞山区', + value: '420203' + }, + { + city: '黄石市', + text: '下陆区', + value: '420204' + }, + { + city: '黄石市', + text: '铁山区', + value: '420205' + }, + { + city: '黄石市', + text: '阳新县', + value: '420222' + }, + { + city: '黄石市', + text: '大冶市', + value: '420281' + } + ], + '420300': [ + { + city: '十堰市', + text: '市辖区', + value: '420301' + }, + { + city: '十堰市', + text: '茅箭区', + value: '420302' + }, + { + city: '十堰市', + text: '张湾区', + value: '420303' + }, + { + city: '十堰市', + text: '郧阳区', + value: '420304' + }, + { + city: '十堰市', + text: '郧西县', + value: '420322' + }, + { + city: '十堰市', + text: '竹山县', + value: '420323' + }, + { + city: '十堰市', + text: '竹溪县', + value: '420324' + }, + { + city: '十堰市', + text: '房县', + value: '420325' + }, + { + city: '十堰市', + text: '丹江口市', + value: '420381' + } + ], + '420500': [ + { + city: '宜昌市', + text: '市辖区', + value: '420501' + }, + { + city: '宜昌市', + text: '西陵区', + value: '420502' + }, + { + city: '宜昌市', + text: '伍家岗区', + value: '420503' + }, + { + city: '宜昌市', + text: '点军区', + value: '420504' + }, + { + city: '宜昌市', + text: '猇亭区', + value: '420505' + }, + { + city: '宜昌市', + text: '夷陵区', + value: '420506' + }, + { + city: '宜昌市', + text: '远安县', + value: '420525' + }, + { + city: '宜昌市', + text: '兴山县', + value: '420526' + }, + { + city: '宜昌市', + text: '秭归县', + value: '420527' + }, + { + city: '宜昌市', + text: '长阳土家族自治县', + value: '420528' + }, + { + city: '宜昌市', + text: '五峰土家族自治县', + value: '420529' + }, + { + city: '宜昌市', + text: '宜都市', + value: '420581' + }, + { + city: '宜昌市', + text: '当阳市', + value: '420582' + }, + { + city: '宜昌市', + text: '枝江市', + value: '420583' + } + ], + '420600': [ + { + city: '襄阳市', + text: '市辖区', + value: '420601' + }, + { + city: '襄阳市', + text: '襄城区', + value: '420602' + }, + { + city: '襄阳市', + text: '樊城区', + value: '420606' + }, + { + city: '襄阳市', + text: '襄州区', + value: '420607' + }, + { + city: '襄阳市', + text: '南漳县', + value: '420624' + }, + { + city: '襄阳市', + text: '谷城县', + value: '420625' + }, + { + city: '襄阳市', + text: '保康县', + value: '420626' + }, + { + city: '襄阳市', + text: '老河口市', + value: '420682' + }, + { + city: '襄阳市', + text: '枣阳市', + value: '420683' + }, + { + city: '襄阳市', + text: '宜城市', + value: '420684' + } + ], + '420700': [ + { + city: '鄂州市', + text: '市辖区', + value: '420701' + }, + { + city: '鄂州市', + text: '梁子湖区', + value: '420702' + }, + { + city: '鄂州市', + text: '华容区', + value: '420703' + }, + { + city: '鄂州市', + text: '鄂城区', + value: '420704' + } + ], + '420800': [ + { + city: '荆门市', + text: '市辖区', + value: '420801' + }, + { + city: '荆门市', + text: '东宝区', + value: '420802' + }, + { + city: '荆门市', + text: '掇刀区', + value: '420804' + }, + { + city: '荆门市', + text: '京山县', + value: '420821' + }, + { + city: '荆门市', + text: '沙洋县', + value: '420822' + }, + { + city: '荆门市', + text: '钟祥市', + value: '420881' + } + ], + '420900': [ + { + city: '孝感市', + text: '市辖区', + value: '420901' + }, + { + city: '孝感市', + text: '孝南区', + value: '420902' + }, + { + city: '孝感市', + text: '孝昌县', + value: '420921' + }, + { + city: '孝感市', + text: '大悟县', + value: '420922' + }, + { + city: '孝感市', + text: '云梦县', + value: '420923' + }, + { + city: '孝感市', + text: '应城市', + value: '420981' + }, + { + city: '孝感市', + text: '安陆市', + value: '420982' + }, + { + city: '孝感市', + text: '汉川市', + value: '420984' + } + ], + '421000': [ + { + city: '荆州市', + text: '市辖区', + value: '421001' + }, + { + city: '荆州市', + text: '沙市区', + value: '421002' + }, + { + city: '荆州市', + text: '荆州区', + value: '421003' + }, + { + city: '荆州市', + text: '公安县', + value: '421022' + }, + { + city: '荆州市', + text: '监利县', + value: '421023' + }, + { + city: '荆州市', + text: '江陵县', + value: '421024' + }, + { + city: '荆州市', + text: '石首市', + value: '421081' + }, + { + city: '荆州市', + text: '洪湖市', + value: '421083' + }, + { + city: '荆州市', + text: '松滋市', + value: '421087' + } + ], + '421100': [ + { + city: '黄冈市', + text: '市辖区', + value: '421101' + }, + { + city: '黄冈市', + text: '黄州区', + value: '421102' + }, + { + city: '黄冈市', + text: '团风县', + value: '421121' + }, + { + city: '黄冈市', + text: '红安县', + value: '421122' + }, + { + city: '黄冈市', + text: '罗田县', + value: '421123' + }, + { + city: '黄冈市', + text: '英山县', + value: '421124' + }, + { + city: '黄冈市', + text: '浠水县', + value: '421125' + }, + { + city: '黄冈市', + text: '蕲春县', + value: '421126' + }, + { + city: '黄冈市', + text: '黄梅县', + value: '421127' + }, + { + city: '黄冈市', + text: '麻城市', + value: '421181' + }, + { + city: '黄冈市', + text: '武穴市', + value: '421182' + } + ], + '421200': [ + { + city: '咸宁市', + text: '市辖区', + value: '421201' + }, + { + city: '咸宁市', + text: '咸安区', + value: '421202' + }, + { + city: '咸宁市', + text: '嘉鱼县', + value: '421221' + }, + { + city: '咸宁市', + text: '通城县', + value: '421222' + }, + { + city: '咸宁市', + text: '崇阳县', + value: '421223' + }, + { + city: '咸宁市', + text: '通山县', + value: '421224' + }, + { + city: '咸宁市', + text: '赤壁市', + value: '421281' + } + ], + '421300': [ + { + city: '随州市', + text: '市辖区', + value: '421301' + }, + { + city: '随州市', + text: '曾都区', + value: '421303' + }, + { + city: '随州市', + text: '随县', + value: '421321' + }, + { + city: '随州市', + text: '广水市', + value: '421381' + } + ], + '422800': [ + { + city: '恩施土家族苗族自治州', + text: '恩施市', + value: '422801' + }, + { + city: '恩施土家族苗族自治州', + text: '利川市', + value: '422802' + }, + { + city: '恩施土家族苗族自治州', + text: '建始县', + value: '422822' + }, + { + city: '恩施土家族苗族自治州', + text: '巴东县', + value: '422823' + }, + { + city: '恩施土家族苗族自治州', + text: '宣恩县', + value: '422825' + }, + { + city: '恩施土家族苗族自治州', + text: '咸丰县', + value: '422826' + }, + { + city: '恩施土家族苗族自治州', + text: '来凤县', + value: '422827' + }, + { + city: '恩施土家族苗族自治州', + text: '鹤峰县', + value: '422828' + } + ], + '429000': [ + { + city: '省直辖县级行政区划', + text: '仙桃市', + value: '429004' + }, + { + city: '省直辖县级行政区划', + text: '潜江市', + value: '429005' + }, + { + city: '省直辖县级行政区划', + text: '天门市', + value: '429006' + }, + { + city: '省直辖县级行政区划', + text: '神农架林区', + value: '429021' + } + ], + '430100': [ + { + city: '长沙市', + text: '市辖区', + value: '430101' + }, + { + city: '长沙市', + text: '芙蓉区', + value: '430102' + }, + { + city: '长沙市', + text: '天心区', + value: '430103' + }, + { + city: '长沙市', + text: '岳麓区', + value: '430104' + }, + { + city: '长沙市', + text: '开福区', + value: '430105' + }, + { + city: '长沙市', + text: '雨花区', + value: '430111' + }, + { + city: '长沙市', + text: '望城区', + value: '430112' + }, + { + city: '长沙市', + text: '长沙县', + value: '430121' + }, + { + city: '长沙市', + text: '宁乡县', + value: '430124' + }, + { + city: '长沙市', + text: '浏阳市', + value: '430181' + } + ], + '430200': [ + { + city: '株洲市', + text: '市辖区', + value: '430201' + }, + { + city: '株洲市', + text: '荷塘区', + value: '430202' + }, + { + city: '株洲市', + text: '芦淞区', + value: '430203' + }, + { + city: '株洲市', + text: '石峰区', + value: '430204' + }, + { + city: '株洲市', + text: '天元区', + value: '430211' + }, + { + city: '株洲市', + text: '株洲县', + value: '430221' + }, + { + city: '株洲市', + text: '攸县', + value: '430223' + }, + { + city: '株洲市', + text: '茶陵县', + value: '430224' + }, + { + city: '株洲市', + text: '炎陵县', + value: '430225' + }, + { + city: '株洲市', + text: '醴陵市', + value: '430281' + } + ], + '430300': [ + { + city: '湘潭市', + text: '市辖区', + value: '430301' + }, + { + city: '湘潭市', + text: '雨湖区', + value: '430302' + }, + { + city: '湘潭市', + text: '岳塘区', + value: '430304' + }, + { + city: '湘潭市', + text: '湘潭县', + value: '430321' + }, + { + city: '湘潭市', + text: '湘乡市', + value: '430381' + }, + { + city: '湘潭市', + text: '韶山市', + value: '430382' + } + ], + '430400': [ + { + city: '衡阳市', + text: '市辖区', + value: '430401' + }, + { + city: '衡阳市', + text: '珠晖区', + value: '430405' + }, + { + city: '衡阳市', + text: '雁峰区', + value: '430406' + }, + { + city: '衡阳市', + text: '石鼓区', + value: '430407' + }, + { + city: '衡阳市', + text: '蒸湘区', + value: '430408' + }, + { + city: '衡阳市', + text: '南岳区', + value: '430412' + }, + { + city: '衡阳市', + text: '衡阳县', + value: '430421' + }, + { + city: '衡阳市', + text: '衡南县', + value: '430422' + }, + { + city: '衡阳市', + text: '衡山县', + value: '430423' + }, + { + city: '衡阳市', + text: '衡东县', + value: '430424' + }, + { + city: '衡阳市', + text: '祁东县', + value: '430426' + }, + { + city: '衡阳市', + text: '耒阳市', + value: '430481' + }, + { + city: '衡阳市', + text: '常宁市', + value: '430482' + } + ], + '430500': [ + { + city: '邵阳市', + text: '市辖区', + value: '430501' + }, + { + city: '邵阳市', + text: '双清区', + value: '430502' + }, + { + city: '邵阳市', + text: '大祥区', + value: '430503' + }, + { + city: '邵阳市', + text: '北塔区', + value: '430511' + }, + { + city: '邵阳市', + text: '邵东县', + value: '430521' + }, + { + city: '邵阳市', + text: '新邵县', + value: '430522' + }, + { + city: '邵阳市', + text: '邵阳县', + value: '430523' + }, + { + city: '邵阳市', + text: '隆回县', + value: '430524' + }, + { + city: '邵阳市', + text: '洞口县', + value: '430525' + }, + { + city: '邵阳市', + text: '绥宁县', + value: '430527' + }, + { + city: '邵阳市', + text: '新宁县', + value: '430528' + }, + { + city: '邵阳市', + text: '城步苗族自治县', + value: '430529' + }, + { + city: '邵阳市', + text: '武冈市', + value: '430581' + } + ], + '430600': [ + { + city: '岳阳市', + text: '市辖区', + value: '430601' + }, + { + city: '岳阳市', + text: '岳阳楼区', + value: '430602' + }, + { + city: '岳阳市', + text: '云溪区', + value: '430603' + }, + { + city: '岳阳市', + text: '君山区', + value: '430611' + }, + { + city: '岳阳市', + text: '岳阳县', + value: '430621' + }, + { + city: '岳阳市', + text: '华容县', + value: '430623' + }, + { + city: '岳阳市', + text: '湘阴县', + value: '430624' + }, + { + city: '岳阳市', + text: '平江县', + value: '430626' + }, + { + city: '岳阳市', + text: '汨罗市', + value: '430681' + }, + { + city: '岳阳市', + text: '临湘市', + value: '430682' + } + ], + '430700': [ + { + city: '常德市', + text: '市辖区', + value: '430701' + }, + { + city: '常德市', + text: '武陵区', + value: '430702' + }, + { + city: '常德市', + text: '鼎城区', + value: '430703' + }, + { + city: '常德市', + text: '安乡县', + value: '430721' + }, + { + city: '常德市', + text: '汉寿县', + value: '430722' + }, + { + city: '常德市', + text: '澧县', + value: '430723' + }, + { + city: '常德市', + text: '临澧县', + value: '430724' + }, + { + city: '常德市', + text: '桃源县', + value: '430725' + }, + { + city: '常德市', + text: '石门县', + value: '430726' + }, + { + city: '常德市', + text: '津市市', + value: '430781' + } + ], + '430800': [ + { + city: '张家界市', + text: '市辖区', + value: '430801' + }, + { + city: '张家界市', + text: '永定区', + value: '430802' + }, + { + city: '张家界市', + text: '武陵源区', + value: '430811' + }, + { + city: '张家界市', + text: '慈利县', + value: '430821' + }, + { + city: '张家界市', + text: '桑植县', + value: '430822' + } + ], + '430900': [ + { + city: '益阳市', + text: '市辖区', + value: '430901' + }, + { + city: '益阳市', + text: '资阳区', + value: '430902' + }, + { + city: '益阳市', + text: '赫山区', + value: '430903' + }, + { + city: '益阳市', + text: '南县', + value: '430921' + }, + { + city: '益阳市', + text: '桃江县', + value: '430922' + }, + { + city: '益阳市', + text: '安化县', + value: '430923' + }, + { + city: '益阳市', + text: '沅江市', + value: '430981' + } + ], + '431000': [ + { + city: '郴州市', + text: '市辖区', + value: '431001' + }, + { + city: '郴州市', + text: '北湖区', + value: '431002' + }, + { + city: '郴州市', + text: '苏仙区', + value: '431003' + }, + { + city: '郴州市', + text: '桂阳县', + value: '431021' + }, + { + city: '郴州市', + text: '宜章县', + value: '431022' + }, + { + city: '郴州市', + text: '永兴县', + value: '431023' + }, + { + city: '郴州市', + text: '嘉禾县', + value: '431024' + }, + { + city: '郴州市', + text: '临武县', + value: '431025' + }, + { + city: '郴州市', + text: '汝城县', + value: '431026' + }, + { + city: '郴州市', + text: '桂东县', + value: '431027' + }, + { + city: '郴州市', + text: '安仁县', + value: '431028' + }, + { + city: '郴州市', + text: '资兴市', + value: '431081' + } + ], + '431100': [ + { + city: '永州市', + text: '市辖区', + value: '431101' + }, + { + city: '永州市', + text: '零陵区', + value: '431102' + }, + { + city: '永州市', + text: '冷水滩区', + value: '431103' + }, + { + city: '永州市', + text: '祁阳县', + value: '431121' + }, + { + city: '永州市', + text: '东安县', + value: '431122' + }, + { + city: '永州市', + text: '双牌县', + value: '431123' + }, + { + city: '永州市', + text: '道县', + value: '431124' + }, + { + city: '永州市', + text: '江永县', + value: '431125' + }, + { + city: '永州市', + text: '宁远县', + value: '431126' + }, + { + city: '永州市', + text: '蓝山县', + value: '431127' + }, + { + city: '永州市', + text: '新田县', + value: '431128' + }, + { + city: '永州市', + text: '江华瑶族自治县', + value: '431129' + } + ], + '431200': [ + { + city: '怀化市', + text: '市辖区', + value: '431201' + }, + { + city: '怀化市', + text: '鹤城区', + value: '431202' + }, + { + city: '怀化市', + text: '中方县', + value: '431221' + }, + { + city: '怀化市', + text: '沅陵县', + value: '431222' + }, + { + city: '怀化市', + text: '辰溪县', + value: '431223' + }, + { + city: '怀化市', + text: '溆浦县', + value: '431224' + }, + { + city: '怀化市', + text: '会同县', + value: '431225' + }, + { + city: '怀化市', + text: '麻阳苗族自治县', + value: '431226' + }, + { + city: '怀化市', + text: '新晃侗族自治县', + value: '431227' + }, + { + city: '怀化市', + text: '芷江侗族自治县', + value: '431228' + }, + { + city: '怀化市', + text: '靖州苗族侗族自治县', + value: '431229' + }, + { + city: '怀化市', + text: '通道侗族自治县', + value: '431230' + }, + { + city: '怀化市', + text: '洪江市', + value: '431281' + } + ], + '431300': [ + { + city: '娄底市', + text: '市辖区', + value: '431301' + }, + { + city: '娄底市', + text: '娄星区', + value: '431302' + }, + { + city: '娄底市', + text: '双峰县', + value: '431321' + }, + { + city: '娄底市', + text: '新化县', + value: '431322' + }, + { + city: '娄底市', + text: '冷水江市', + value: '431381' + }, + { + city: '娄底市', + text: '涟源市', + value: '431382' + } + ], + '433100': [ + { + city: '湘西土家族苗族自治州', + text: '吉首市', + value: '433101' + }, + { + city: '湘西土家族苗族自治州', + text: '泸溪县', + value: '433122' + }, + { + city: '湘西土家族苗族自治州', + text: '凤凰县', + value: '433123' + }, + { + city: '湘西土家族苗族自治州', + text: '花垣县', + value: '433124' + }, + { + city: '湘西土家族苗族自治州', + text: '保靖县', + value: '433125' + }, + { + city: '湘西土家族苗族自治州', + text: '古丈县', + value: '433126' + }, + { + city: '湘西土家族苗族自治州', + text: '永顺县', + value: '433127' + }, + { + city: '湘西土家族苗族自治州', + text: '龙山县', + value: '433130' + } + ], + '440100': [ + { + city: '广州市', + text: '市辖区', + value: '440101' + }, + { + city: '广州市', + text: '荔湾区', + value: '440103' + }, + { + city: '广州市', + text: '越秀区', + value: '440104' + }, + { + city: '广州市', + text: '海珠区', + value: '440105' + }, + { + city: '广州市', + text: '天河区', + value: '440106' + }, + { + city: '广州市', + text: '白云区', + value: '440111' + }, + { + city: '广州市', + text: '黄埔区', + value: '440112' + }, + { + city: '广州市', + text: '番禺区', + value: '440113' + }, + { + city: '广州市', + text: '花都区', + value: '440114' + }, + { + city: '广州市', + text: '南沙区', + value: '440115' + }, + { + city: '广州市', + text: '从化区', + value: '440117' + }, + { + city: '广州市', + text: '增城区', + value: '440118' + } + ], + '440200': [ + { + city: '韶关市', + text: '市辖区', + value: '440201' + }, + { + city: '韶关市', + text: '武江区', + value: '440203' + }, + { + city: '韶关市', + text: '浈江区', + value: '440204' + }, + { + city: '韶关市', + text: '曲江区', + value: '440205' + }, + { + city: '韶关市', + text: '始兴县', + value: '440222' + }, + { + city: '韶关市', + text: '仁化县', + value: '440224' + }, + { + city: '韶关市', + text: '翁源县', + value: '440229' + }, + { + city: '韶关市', + text: '乳源瑶族自治县', + value: '440232' + }, + { + city: '韶关市', + text: '新丰县', + value: '440233' + }, + { + city: '韶关市', + text: '乐昌市', + value: '440281' + }, + { + city: '韶关市', + text: '南雄市', + value: '440282' + } + ], + '440300': [ + { + city: '深圳市', + text: '市辖区', + value: '440301' + }, + { + city: '深圳市', + text: '罗湖区', + value: '440303' + }, + { + city: '深圳市', + text: '福田区', + value: '440304' + }, + { + city: '深圳市', + text: '南山区', + value: '440305' + }, + { + city: '深圳市', + text: '宝安区', + value: '440306' + }, + { + city: '深圳市', + text: '龙岗区', + value: '440307' + }, + { + city: '深圳市', + text: '盐田区', + value: '440308' + } + ], + '440400': [ + { + city: '珠海市', + text: '市辖区', + value: '440401' + }, + { + city: '珠海市', + text: '香洲区', + value: '440402' + }, + { + city: '珠海市', + text: '斗门区', + value: '440403' + }, + { + city: '珠海市', + text: '金湾区', + value: '440404' + } + ], + '440500': [ + { + city: '汕头市', + text: '市辖区', + value: '440501' + }, + { + city: '汕头市', + text: '龙湖区', + value: '440507' + }, + { + city: '汕头市', + text: '金平区', + value: '440511' + }, + { + city: '汕头市', + text: '濠江区', + value: '440512' + }, + { + city: '汕头市', + text: '潮阳区', + value: '440513' + }, + { + city: '汕头市', + text: '潮南区', + value: '440514' + }, + { + city: '汕头市', + text: '澄海区', + value: '440515' + }, + { + city: '汕头市', + text: '南澳县', + value: '440523' + } + ], + '440600': [ + { + city: '佛山市', + text: '市辖区', + value: '440601' + }, + { + city: '佛山市', + text: '禅城区', + value: '440604' + }, + { + city: '佛山市', + text: '南海区', + value: '440605' + }, + { + city: '佛山市', + text: '顺德区', + value: '440606' + }, + { + city: '佛山市', + text: '三水区', + value: '440607' + }, + { + city: '佛山市', + text: '高明区', + value: '440608' + } + ], + '440700': [ + { + city: '江门市', + text: '市辖区', + value: '440701' + }, + { + city: '江门市', + text: '蓬江区', + value: '440703' + }, + { + city: '江门市', + text: '江海区', + value: '440704' + }, + { + city: '江门市', + text: '新会区', + value: '440705' + }, + { + city: '江门市', + text: '台山市', + value: '440781' + }, + { + city: '江门市', + text: '开平市', + value: '440783' + }, + { + city: '江门市', + text: '鹤山市', + value: '440784' + }, + { + city: '江门市', + text: '恩平市', + value: '440785' + } + ], + '440800': [ + { + city: '湛江市', + text: '市辖区', + value: '440801' + }, + { + city: '湛江市', + text: '赤坎区', + value: '440802' + }, + { + city: '湛江市', + text: '霞山区', + value: '440803' + }, + { + city: '湛江市', + text: '坡头区', + value: '440804' + }, + { + city: '湛江市', + text: '麻章区', + value: '440811' + }, + { + city: '湛江市', + text: '遂溪县', + value: '440823' + }, + { + city: '湛江市', + text: '徐闻县', + value: '440825' + }, + { + city: '湛江市', + text: '廉江市', + value: '440881' + }, + { + city: '湛江市', + text: '雷州市', + value: '440882' + }, + { + city: '湛江市', + text: '吴川市', + value: '440883' + } + ], + '440900': [ + { + city: '茂名市', + text: '市辖区', + value: '440901' + }, + { + city: '茂名市', + text: '茂南区', + value: '440902' + }, + { + city: '茂名市', + text: '电白区', + value: '440904' + }, + { + city: '茂名市', + text: '高州市', + value: '440981' + }, + { + city: '茂名市', + text: '化州市', + value: '440982' + }, + { + city: '茂名市', + text: '信宜市', + value: '440983' + } + ], + '441200': [ + { + city: '肇庆市', + text: '市辖区', + value: '441201' + }, + { + city: '肇庆市', + text: '端州区', + value: '441202' + }, + { + city: '肇庆市', + text: '鼎湖区', + value: '441203' + }, + { + city: '肇庆市', + text: '高要区', + value: '441204' + }, + { + city: '肇庆市', + text: '广宁县', + value: '441223' + }, + { + city: '肇庆市', + text: '怀集县', + value: '441224' + }, + { + city: '肇庆市', + text: '封开县', + value: '441225' + }, + { + city: '肇庆市', + text: '德庆县', + value: '441226' + }, + { + city: '肇庆市', + text: '四会市', + value: '441284' + } + ], + '441300': [ + { + city: '惠州市', + text: '市辖区', + value: '441301' + }, + { + city: '惠州市', + text: '惠城区', + value: '441302' + }, + { + city: '惠州市', + text: '惠阳区', + value: '441303' + }, + { + city: '惠州市', + text: '博罗县', + value: '441322' + }, + { + city: '惠州市', + text: '惠东县', + value: '441323' + }, + { + city: '惠州市', + text: '龙门县', + value: '441324' + } + ], + '441400': [ + { + city: '梅州市', + text: '市辖区', + value: '441401' + }, + { + city: '梅州市', + text: '梅江区', + value: '441402' + }, + { + city: '梅州市', + text: '梅县区', + value: '441403' + }, + { + city: '梅州市', + text: '大埔县', + value: '441422' + }, + { + city: '梅州市', + text: '丰顺县', + value: '441423' + }, + { + city: '梅州市', + text: '五华县', + value: '441424' + }, + { + city: '梅州市', + text: '平远县', + value: '441426' + }, + { + city: '梅州市', + text: '蕉岭县', + value: '441427' + }, + { + city: '梅州市', + text: '兴宁市', + value: '441481' + } + ], + '441500': [ + { + city: '汕尾市', + text: '市辖区', + value: '441501' + }, + { + city: '汕尾市', + text: '城区', + value: '441502' + }, + { + city: '汕尾市', + text: '海丰县', + value: '441521' + }, + { + city: '汕尾市', + text: '陆河县', + value: '441523' + }, + { + city: '汕尾市', + text: '陆丰市', + value: '441581' + } + ], + '441600': [ + { + city: '河源市', + text: '市辖区', + value: '441601' + }, + { + city: '河源市', + text: '源城区', + value: '441602' + }, + { + city: '河源市', + text: '紫金县', + value: '441621' + }, + { + city: '河源市', + text: '龙川县', + value: '441622' + }, + { + city: '河源市', + text: '连平县', + value: '441623' + }, + { + city: '河源市', + text: '和平县', + value: '441624' + }, + { + city: '河源市', + text: '东源县', + value: '441625' + } + ], + '441700': [ + { + city: '阳江市', + text: '市辖区', + value: '441701' + }, + { + city: '阳江市', + text: '江城区', + value: '441702' + }, + { + city: '阳江市', + text: '阳东区', + value: '441704' + }, + { + city: '阳江市', + text: '阳西县', + value: '441721' + }, + { + city: '阳江市', + text: '阳春市', + value: '441781' + } + ], + '441800': [ + { + city: '清远市', + text: '市辖区', + value: '441801' + }, + { + city: '清远市', + text: '清城区', + value: '441802' + }, + { + city: '清远市', + text: '清新区', + value: '441803' + }, + { + city: '清远市', + text: '佛冈县', + value: '441821' + }, + { + city: '清远市', + text: '阳山县', + value: '441823' + }, + { + city: '清远市', + text: '连山壮族瑶族自治县', + value: '441825' + }, + { + city: '清远市', + text: '连南瑶族自治县', + value: '441826' + }, + { + city: '清远市', + text: '英德市', + value: '441881' + }, + { + city: '清远市', + text: '连州市', + value: '441882' + } + ], + '441900': [], + '442000': [], + '445100': [ + { + city: '潮州市', + text: '市辖区', + value: '445101' + }, + { + city: '潮州市', + text: '湘桥区', + value: '445102' + }, + { + city: '潮州市', + text: '潮安区', + value: '445103' + }, + { + city: '潮州市', + text: '饶平县', + value: '445122' + } + ], + '445200': [ + { + city: '揭阳市', + text: '市辖区', + value: '445201' + }, + { + city: '揭阳市', + text: '榕城区', + value: '445202' + }, + { + city: '揭阳市', + text: '揭东区', + value: '445203' + }, + { + city: '揭阳市', + text: '揭西县', + value: '445222' + }, + { + city: '揭阳市', + text: '惠来县', + value: '445224' + }, + { + city: '揭阳市', + text: '普宁市', + value: '445281' + } + ], + '445300': [ + { + city: '云浮市', + text: '市辖区', + value: '445301' + }, + { + city: '云浮市', + text: '云城区', + value: '445302' + }, + { + city: '云浮市', + text: '云安区', + value: '445303' + }, + { + city: '云浮市', + text: '新兴县', + value: '445321' + }, + { + city: '云浮市', + text: '郁南县', + value: '445322' + }, + { + city: '云浮市', + text: '罗定市', + value: '445381' + } + ], + '450100': [ + { + city: '南宁市', + text: '市辖区', + value: '450101' + }, + { + city: '南宁市', + text: '兴宁区', + value: '450102' + }, + { + city: '南宁市', + text: '青秀区', + value: '450103' + }, + { + city: '南宁市', + text: '江南区', + value: '450105' + }, + { + city: '南宁市', + text: '西乡塘区', + value: '450107' + }, + { + city: '南宁市', + text: '良庆区', + value: '450108' + }, + { + city: '南宁市', + text: '邕宁区', + value: '450109' + }, + { + city: '南宁市', + text: '武鸣区', + value: '450110' + }, + { + city: '南宁市', + text: '隆安县', + value: '450123' + }, + { + city: '南宁市', + text: '马山县', + value: '450124' + }, + { + city: '南宁市', + text: '上林县', + value: '450125' + }, + { + city: '南宁市', + text: '宾阳县', + value: '450126' + }, + { + city: '南宁市', + text: '横县', + value: '450127' + } + ], + '450200': [ + { + city: '柳州市', + text: '市辖区', + value: '450201' + }, + { + city: '柳州市', + text: '城中区', + value: '450202' + }, + { + city: '柳州市', + text: '鱼峰区', + value: '450203' + }, + { + city: '柳州市', + text: '柳南区', + value: '450204' + }, + { + city: '柳州市', + text: '柳北区', + value: '450205' + }, + { + city: '柳州市', + text: '柳江区', + value: '450206' + }, + { + city: '柳州市', + text: '柳城县', + value: '450222' + }, + { + city: '柳州市', + text: '鹿寨县', + value: '450223' + }, + { + city: '柳州市', + text: '融安县', + value: '450224' + }, + { + city: '柳州市', + text: '融水苗族自治县', + value: '450225' + }, + { + city: '柳州市', + text: '三江侗族自治县', + value: '450226' + } + ], + '450300': [ + { + city: '桂林市', + text: '市辖区', + value: '450301' + }, + { + city: '桂林市', + text: '秀峰区', + value: '450302' + }, + { + city: '桂林市', + text: '叠彩区', + value: '450303' + }, + { + city: '桂林市', + text: '象山区', + value: '450304' + }, + { + city: '桂林市', + text: '七星区', + value: '450305' + }, + { + city: '桂林市', + text: '雁山区', + value: '450311' + }, + { + city: '桂林市', + text: '临桂区', + value: '450312' + }, + { + city: '桂林市', + text: '阳朔县', + value: '450321' + }, + { + city: '桂林市', + text: '灵川县', + value: '450323' + }, + { + city: '桂林市', + text: '全州县', + value: '450324' + }, + { + city: '桂林市', + text: '兴安县', + value: '450325' + }, + { + city: '桂林市', + text: '永福县', + value: '450326' + }, + { + city: '桂林市', + text: '灌阳县', + value: '450327' + }, + { + city: '桂林市', + text: '龙胜各族自治县', + value: '450328' + }, + { + city: '桂林市', + text: '资源县', + value: '450329' + }, + { + city: '桂林市', + text: '平乐县', + value: '450330' + }, + { + city: '桂林市', + text: '荔浦县', + value: '450331' + }, + { + city: '桂林市', + text: '恭城瑶族自治县', + value: '450332' + } + ], + '450400': [ + { + city: '梧州市', + text: '市辖区', + value: '450401' + }, + { + city: '梧州市', + text: '万秀区', + value: '450403' + }, + { + city: '梧州市', + text: '长洲区', + value: '450405' + }, + { + city: '梧州市', + text: '龙圩区', + value: '450406' + }, + { + city: '梧州市', + text: '苍梧县', + value: '450421' + }, + { + city: '梧州市', + text: '藤县', + value: '450422' + }, + { + city: '梧州市', + text: '蒙山县', + value: '450423' + }, + { + city: '梧州市', + text: '岑溪市', + value: '450481' + } + ], + '450500': [ + { + city: '北海市', + text: '市辖区', + value: '450501' + }, + { + city: '北海市', + text: '海城区', + value: '450502' + }, + { + city: '北海市', + text: '银海区', + value: '450503' + }, + { + city: '北海市', + text: '铁山港区', + value: '450512' + }, + { + city: '北海市', + text: '合浦县', + value: '450521' + } + ], + '450600': [ + { + city: '防城港市', + text: '市辖区', + value: '450601' + }, + { + city: '防城港市', + text: '港口区', + value: '450602' + }, + { + city: '防城港市', + text: '防城区', + value: '450603' + }, + { + city: '防城港市', + text: '上思县', + value: '450621' + }, + { + city: '防城港市', + text: '东兴市', + value: '450681' + } + ], + '450700': [ + { + city: '钦州市', + text: '市辖区', + value: '450701' + }, + { + city: '钦州市', + text: '钦南区', + value: '450702' + }, + { + city: '钦州市', + text: '钦北区', + value: '450703' + }, + { + city: '钦州市', + text: '灵山县', + value: '450721' + }, + { + city: '钦州市', + text: '浦北县', + value: '450722' + } + ], + '450800': [ + { + city: '贵港市', + text: '市辖区', + value: '450801' + }, + { + city: '贵港市', + text: '港北区', + value: '450802' + }, + { + city: '贵港市', + text: '港南区', + value: '450803' + }, + { + city: '贵港市', + text: '覃塘区', + value: '450804' + }, + { + city: '贵港市', + text: '平南县', + value: '450821' + }, + { + city: '贵港市', + text: '桂平市', + value: '450881' + } + ], + '450900': [ + { + city: '玉林市', + text: '市辖区', + value: '450901' + }, + { + city: '玉林市', + text: '玉州区', + value: '450902' + }, + { + city: '玉林市', + text: '福绵区', + value: '450903' + }, + { + city: '玉林市', + text: '容县', + value: '450921' + }, + { + city: '玉林市', + text: '陆川县', + value: '450922' + }, + { + city: '玉林市', + text: '博白县', + value: '450923' + }, + { + city: '玉林市', + text: '兴业县', + value: '450924' + }, + { + city: '玉林市', + text: '北流市', + value: '450981' + } + ], + '451000': [ + { + city: '百色市', + text: '市辖区', + value: '451001' + }, + { + city: '百色市', + text: '右江区', + value: '451002' + }, + { + city: '百色市', + text: '田阳县', + value: '451021' + }, + { + city: '百色市', + text: '田东县', + value: '451022' + }, + { + city: '百色市', + text: '平果县', + value: '451023' + }, + { + city: '百色市', + text: '德保县', + value: '451024' + }, + { + city: '百色市', + text: '那坡县', + value: '451026' + }, + { + city: '百色市', + text: '凌云县', + value: '451027' + }, + { + city: '百色市', + text: '乐业县', + value: '451028' + }, + { + city: '百色市', + text: '田林县', + value: '451029' + }, + { + city: '百色市', + text: '西林县', + value: '451030' + }, + { + city: '百色市', + text: '隆林各族自治县', + value: '451031' + }, + { + city: '百色市', + text: '靖西市', + value: '451081' + } + ], + '451100': [ + { + city: '贺州市', + text: '市辖区', + value: '451101' + }, + { + city: '贺州市', + text: '八步区', + value: '451102' + }, + { + city: '贺州市', + text: '平桂区', + value: '451103' + }, + { + city: '贺州市', + text: '昭平县', + value: '451121' + }, + { + city: '贺州市', + text: '钟山县', + value: '451122' + }, + { + city: '贺州市', + text: '富川瑶族自治县', + value: '451123' + } + ], + '451200': [ + { + city: '河池市', + text: '市辖区', + value: '451201' + }, + { + city: '河池市', + text: '金城江区', + value: '451202' + }, + { + city: '河池市', + text: '南丹县', + value: '451221' + }, + { + city: '河池市', + text: '天峨县', + value: '451222' + }, + { + city: '河池市', + text: '凤山县', + value: '451223' + }, + { + city: '河池市', + text: '东兰县', + value: '451224' + }, + { + city: '河池市', + text: '罗城仫佬族自治县', + value: '451225' + }, + { + city: '河池市', + text: '环江毛南族自治县', + value: '451226' + }, + { + city: '河池市', + text: '巴马瑶族自治县', + value: '451227' + }, + { + city: '河池市', + text: '都安瑶族自治县', + value: '451228' + }, + { + city: '河池市', + text: '大化瑶族自治县', + value: '451229' + }, + { + city: '河池市', + text: '宜州市', + value: '451281' + } + ], + '451300': [ + { + city: '来宾市', + text: '市辖区', + value: '451301' + }, + { + city: '来宾市', + text: '兴宾区', + value: '451302' + }, + { + city: '来宾市', + text: '忻城县', + value: '451321' + }, + { + city: '来宾市', + text: '象州县', + value: '451322' + }, + { + city: '来宾市', + text: '武宣县', + value: '451323' + }, + { + city: '来宾市', + text: '金秀瑶族自治县', + value: '451324' + }, + { + city: '来宾市', + text: '合山市', + value: '451381' + } + ], + '451400': [ + { + city: '崇左市', + text: '市辖区', + value: '451401' + }, + { + city: '崇左市', + text: '江州区', + value: '451402' + }, + { + city: '崇左市', + text: '扶绥县', + value: '451421' + }, + { + city: '崇左市', + text: '宁明县', + value: '451422' + }, + { + city: '崇左市', + text: '龙州县', + value: '451423' + }, + { + city: '崇左市', + text: '大新县', + value: '451424' + }, + { + city: '崇左市', + text: '天等县', + value: '451425' + }, + { + city: '崇左市', + text: '凭祥市', + value: '451481' + } + ], + '460100': [ + { + city: '海口市', + text: '市辖区', + value: '460101' + }, + { + city: '海口市', + text: '秀英区', + value: '460105' + }, + { + city: '海口市', + text: '龙华区', + value: '460106' + }, + { + city: '海口市', + text: '琼山区', + value: '460107' + }, + { + city: '海口市', + text: '美兰区', + value: '460108' + } + ], + '460200': [ + { + city: '三亚市', + text: '市辖区', + value: '460201' + }, + { + city: '三亚市', + text: '海棠区', + value: '460202' + }, + { + city: '三亚市', + text: '吉阳区', + value: '460203' + }, + { + city: '三亚市', + text: '天涯区', + value: '460204' + }, + { + city: '三亚市', + text: '崖州区', + value: '460205' + } + ], + '460300': [], + '460400': [], + '469000': [ + { + city: '省直辖县级行政区划', + text: '五指山市', + value: '469001' + }, + { + city: '省直辖县级行政区划', + text: '琼海市', + value: '469002' + }, + { + city: '省直辖县级行政区划', + text: '文昌市', + value: '469005' + }, + { + city: '省直辖县级行政区划', + text: '万宁市', + value: '469006' + }, + { + city: '省直辖县级行政区划', + text: '东方市', + value: '469007' + }, + { + city: '省直辖县级行政区划', + text: '定安县', + value: '469021' + }, + { + city: '省直辖县级行政区划', + text: '屯昌县', + value: '469022' + }, + { + city: '省直辖县级行政区划', + text: '澄迈县', + value: '469023' + }, + { + city: '省直辖县级行政区划', + text: '临高县', + value: '469024' + }, + { + city: '省直辖县级行政区划', + text: '白沙黎族自治县', + value: '469025' + }, + { + city: '省直辖县级行政区划', + text: '昌江黎族自治县', + value: '469026' + }, + { + city: '省直辖县级行政区划', + text: '乐东黎族自治县', + value: '469027' + }, + { + city: '省直辖县级行政区划', + text: '陵水黎族自治县', + value: '469028' + }, + { + city: '省直辖县级行政区划', + text: '保亭黎族苗族自治县', + value: '469029' + }, + { + city: '省直辖县级行政区划', + text: '琼中黎族苗族自治县', + value: '469030' + } + ], + '500100': [ + { + city: '市辖区', + text: '万州区', + value: '500101' + }, + { + city: '市辖区', + text: '涪陵区', + value: '500102' + }, + { + city: '市辖区', + text: '渝中区', + value: '500103' + }, + { + city: '市辖区', + text: '大渡口区', + value: '500104' + }, + { + city: '市辖区', + text: '江北区', + value: '500105' + }, + { + city: '市辖区', + text: '沙坪坝区', + value: '500106' + }, + { + city: '市辖区', + text: '九龙坡区', + value: '500107' + }, + { + city: '市辖区', + text: '南岸区', + value: '500108' + }, + { + city: '市辖区', + text: '北碚区', + value: '500109' + }, + { + city: '市辖区', + text: '綦江区', + value: '500110' + }, + { + city: '市辖区', + text: '大足区', + value: '500111' + }, + { + city: '市辖区', + text: '渝北区', + value: '500112' + }, + { + city: '市辖区', + text: '巴南区', + value: '500113' + }, + { + city: '市辖区', + text: '黔江区', + value: '500114' + }, + { + city: '市辖区', + text: '长寿区', + value: '500115' + }, + { + city: '市辖区', + text: '江津区', + value: '500116' + }, + { + city: '市辖区', + text: '合川区', + value: '500117' + }, + { + city: '市辖区', + text: '永川区', + value: '500118' + }, + { + city: '市辖区', + text: '南川区', + value: '500119' + }, + { + city: '市辖区', + text: '璧山区', + value: '500120' + }, + { + city: '市辖区', + text: '铜梁区', + value: '500151' + }, + { + city: '市辖区', + text: '潼南区', + value: '500152' + }, + { + city: '市辖区', + text: '荣昌区', + value: '500153' + }, + { + city: '市辖区', + text: '开州区', + value: '500154' + } + ], + '500200': [ + { + city: '县', + text: '梁平县', + value: '500228' + }, + { + city: '县', + text: '城口县', + value: '500229' + }, + { + city: '县', + text: '丰都县', + value: '500230' + }, + { + city: '县', + text: '垫江县', + value: '500231' + }, + { + city: '县', + text: '武隆县', + value: '500232' + }, + { + city: '县', + text: '忠县', + value: '500233' + }, + { + city: '县', + text: '云阳县', + value: '500235' + }, + { + city: '县', + text: '奉节县', + value: '500236' + }, + { + city: '县', + text: '巫山县', + value: '500237' + }, + { + city: '县', + text: '巫溪县', + value: '500238' + }, + { + city: '县', + text: '石柱土家族自治县', + value: '500240' + }, + { + city: '县', + text: '秀山土家族苗族自治县', + value: '500241' + }, + { + city: '县', + text: '酉阳土家族苗族自治县', + value: '500242' + }, + { + city: '县', + text: '彭水苗族土家族自治县', + value: '500243' + } + ], + '510100': [ + { + city: '成都市', + text: '市辖区', + value: '510101' + }, + { + city: '成都市', + text: '锦江区', + value: '510104' + }, + { + city: '成都市', + text: '青羊区', + value: '510105' + }, + { + city: '成都市', + text: '金牛区', + value: '510106' + }, + { + city: '成都市', + text: '武侯区', + value: '510107' + }, + { + city: '成都市', + text: '成华区', + value: '510108' + }, + { + city: '成都市', + text: '龙泉驿区', + value: '510112' + }, + { + city: '成都市', + text: '青白江区', + value: '510113' + }, + { + city: '成都市', + text: '新都区', + value: '510114' + }, + { + city: '成都市', + text: '温江区', + value: '510115' + }, + { + city: '成都市', + text: '双流区', + value: '510116' + }, + { + city: '成都市', + text: '金堂县', + value: '510121' + }, + { + city: '成都市', + text: '郫县', + value: '510124' + }, + { + city: '成都市', + text: '大邑县', + value: '510129' + }, + { + city: '成都市', + text: '蒲江县', + value: '510131' + }, + { + city: '成都市', + text: '新津县', + value: '510132' + }, + { + city: '成都市', + text: '都江堰市', + value: '510181' + }, + { + city: '成都市', + text: '彭州市', + value: '510182' + }, + { + city: '成都市', + text: '邛崃市', + value: '510183' + }, + { + city: '成都市', + text: '崇州市', + value: '510184' + }, + { + city: '成都市', + text: '简阳市', + value: '510185' + } + ], + '510300': [ + { + city: '自贡市', + text: '市辖区', + value: '510301' + }, + { + city: '自贡市', + text: '自流井区', + value: '510302' + }, + { + city: '自贡市', + text: '贡井区', + value: '510303' + }, + { + city: '自贡市', + text: '大安区', + value: '510304' + }, + { + city: '自贡市', + text: '沿滩区', + value: '510311' + }, + { + city: '自贡市', + text: '荣县', + value: '510321' + }, + { + city: '自贡市', + text: '富顺县', + value: '510322' + } + ], + '510400': [ + { + city: '攀枝花市', + text: '市辖区', + value: '510401' + }, + { + city: '攀枝花市', + text: '东区', + value: '510402' + }, + { + city: '攀枝花市', + text: '西区', + value: '510403' + }, + { + city: '攀枝花市', + text: '仁和区', + value: '510411' + }, + { + city: '攀枝花市', + text: '米易县', + value: '510421' + }, + { + city: '攀枝花市', + text: '盐边县', + value: '510422' + } + ], + '510500': [ + { + city: '泸州市', + text: '市辖区', + value: '510501' + }, + { + city: '泸州市', + text: '江阳区', + value: '510502' + }, + { + city: '泸州市', + text: '纳溪区', + value: '510503' + }, + { + city: '泸州市', + text: '龙马潭区', + value: '510504' + }, + { + city: '泸州市', + text: '泸县', + value: '510521' + }, + { + city: '泸州市', + text: '合江县', + value: '510522' + }, + { + city: '泸州市', + text: '叙永县', + value: '510524' + }, + { + city: '泸州市', + text: '古蔺县', + value: '510525' + } + ], + '510600': [ + { + city: '德阳市', + text: '市辖区', + value: '510601' + }, + { + city: '德阳市', + text: '旌阳区', + value: '510603' + }, + { + city: '德阳市', + text: '中江县', + value: '510623' + }, + { + city: '德阳市', + text: '罗江县', + value: '510626' + }, + { + city: '德阳市', + text: '广汉市', + value: '510681' + }, + { + city: '德阳市', + text: '什邡市', + value: '510682' + }, + { + city: '德阳市', + text: '绵竹市', + value: '510683' + } + ], + '510700': [ + { + city: '绵阳市', + text: '市辖区', + value: '510701' + }, + { + city: '绵阳市', + text: '涪城区', + value: '510703' + }, + { + city: '绵阳市', + text: '游仙区', + value: '510704' + }, + { + city: '绵阳市', + text: '安州区', + value: '510705' + }, + { + city: '绵阳市', + text: '三台县', + value: '510722' + }, + { + city: '绵阳市', + text: '盐亭县', + value: '510723' + }, + { + city: '绵阳市', + text: '梓潼县', + value: '510725' + }, + { + city: '绵阳市', + text: '北川羌族自治县', + value: '510726' + }, + { + city: '绵阳市', + text: '平武县', + value: '510727' + }, + { + city: '绵阳市', + text: '江油市', + value: '510781' + } + ], + '510800': [ + { + city: '广元市', + text: '市辖区', + value: '510801' + }, + { + city: '广元市', + text: '利州区', + value: '510802' + }, + { + city: '广元市', + text: '昭化区', + value: '510811' + }, + { + city: '广元市', + text: '朝天区', + value: '510812' + }, + { + city: '广元市', + text: '旺苍县', + value: '510821' + }, + { + city: '广元市', + text: '青川县', + value: '510822' + }, + { + city: '广元市', + text: '剑阁县', + value: '510823' + }, + { + city: '广元市', + text: '苍溪县', + value: '510824' + } + ], + '510900': [ + { + city: '遂宁市', + text: '市辖区', + value: '510901' + }, + { + city: '遂宁市', + text: '船山区', + value: '510903' + }, + { + city: '遂宁市', + text: '安居区', + value: '510904' + }, + { + city: '遂宁市', + text: '蓬溪县', + value: '510921' + }, + { + city: '遂宁市', + text: '射洪县', + value: '510922' + }, + { + city: '遂宁市', + text: '大英县', + value: '510923' + } + ], + '511000': [ + { + city: '内江市', + text: '市辖区', + value: '511001' + }, + { + city: '内江市', + text: '市中区', + value: '511002' + }, + { + city: '内江市', + text: '东兴区', + value: '511011' + }, + { + city: '内江市', + text: '威远县', + value: '511024' + }, + { + city: '内江市', + text: '资中县', + value: '511025' + }, + { + city: '内江市', + text: '隆昌县', + value: '511028' + } + ], + '511100': [ + { + city: '乐山市', + text: '市辖区', + value: '511101' + }, + { + city: '乐山市', + text: '市中区', + value: '511102' + }, + { + city: '乐山市', + text: '沙湾区', + value: '511111' + }, + { + city: '乐山市', + text: '五通桥区', + value: '511112' + }, + { + city: '乐山市', + text: '金口河区', + value: '511113' + }, + { + city: '乐山市', + text: '犍为县', + value: '511123' + }, + { + city: '乐山市', + text: '井研县', + value: '511124' + }, + { + city: '乐山市', + text: '夹江县', + value: '511126' + }, + { + city: '乐山市', + text: '沐川县', + value: '511129' + }, + { + city: '乐山市', + text: '峨边彝族自治县', + value: '511132' + }, + { + city: '乐山市', + text: '马边彝族自治县', + value: '511133' + }, + { + city: '乐山市', + text: '峨眉山市', + value: '511181' + } + ], + '511300': [ + { + city: '南充市', + text: '市辖区', + value: '511301' + }, + { + city: '南充市', + text: '顺庆区', + value: '511302' + }, + { + city: '南充市', + text: '高坪区', + value: '511303' + }, + { + city: '南充市', + text: '嘉陵区', + value: '511304' + }, + { + city: '南充市', + text: '南部县', + value: '511321' + }, + { + city: '南充市', + text: '营山县', + value: '511322' + }, + { + city: '南充市', + text: '蓬安县', + value: '511323' + }, + { + city: '南充市', + text: '仪陇县', + value: '511324' + }, + { + city: '南充市', + text: '西充县', + value: '511325' + }, + { + city: '南充市', + text: '阆中市', + value: '511381' + } + ], + '511400': [ + { + city: '眉山市', + text: '市辖区', + value: '511401' + }, + { + city: '眉山市', + text: '东坡区', + value: '511402' + }, + { + city: '眉山市', + text: '彭山区', + value: '511403' + }, + { + city: '眉山市', + text: '仁寿县', + value: '511421' + }, + { + city: '眉山市', + text: '洪雅县', + value: '511423' + }, + { + city: '眉山市', + text: '丹棱县', + value: '511424' + }, + { + city: '眉山市', + text: '青神县', + value: '511425' + } + ], + '511500': [ + { + city: '宜宾市', + text: '市辖区', + value: '511501' + }, + { + city: '宜宾市', + text: '翠屏区', + value: '511502' + }, + { + city: '宜宾市', + text: '南溪区', + value: '511503' + }, + { + city: '宜宾市', + text: '宜宾县', + value: '511521' + }, + { + city: '宜宾市', + text: '江安县', + value: '511523' + }, + { + city: '宜宾市', + text: '长宁县', + value: '511524' + }, + { + city: '宜宾市', + text: '高县', + value: '511525' + }, + { + city: '宜宾市', + text: '珙县', + value: '511526' + }, + { + city: '宜宾市', + text: '筠连县', + value: '511527' + }, + { + city: '宜宾市', + text: '兴文县', + value: '511528' + }, + { + city: '宜宾市', + text: '屏山县', + value: '511529' + } + ], + '511600': [ + { + city: '广安市', + text: '市辖区', + value: '511601' + }, + { + city: '广安市', + text: '广安区', + value: '511602' + }, + { + city: '广安市', + text: '前锋区', + value: '511603' + }, + { + city: '广安市', + text: '岳池县', + value: '511621' + }, + { + city: '广安市', + text: '武胜县', + value: '511622' + }, + { + city: '广安市', + text: '邻水县', + value: '511623' + }, + { + city: '广安市', + text: '华蓥市', + value: '511681' + } + ], + '511700': [ + { + city: '达州市', + text: '市辖区', + value: '511701' + }, + { + city: '达州市', + text: '通川区', + value: '511702' + }, + { + city: '达州市', + text: '达川区', + value: '511703' + }, + { + city: '达州市', + text: '宣汉县', + value: '511722' + }, + { + city: '达州市', + text: '开江县', + value: '511723' + }, + { + city: '达州市', + text: '大竹县', + value: '511724' + }, + { + city: '达州市', + text: '渠县', + value: '511725' + }, + { + city: '达州市', + text: '万源市', + value: '511781' + } + ], + '511800': [ + { + city: '雅安市', + text: '市辖区', + value: '511801' + }, + { + city: '雅安市', + text: '雨城区', + value: '511802' + }, + { + city: '雅安市', + text: '名山区', + value: '511803' + }, + { + city: '雅安市', + text: '荥经县', + value: '511822' + }, + { + city: '雅安市', + text: '汉源县', + value: '511823' + }, + { + city: '雅安市', + text: '石棉县', + value: '511824' + }, + { + city: '雅安市', + text: '天全县', + value: '511825' + }, + { + city: '雅安市', + text: '芦山县', + value: '511826' + }, + { + city: '雅安市', + text: '宝兴县', + value: '511827' + } + ], + '511900': [ + { + city: '巴中市', + text: '市辖区', + value: '511901' + }, + { + city: '巴中市', + text: '巴州区', + value: '511902' + }, + { + city: '巴中市', + text: '恩阳区', + value: '511903' + }, + { + city: '巴中市', + text: '通江县', + value: '511921' + }, + { + city: '巴中市', + text: '南江县', + value: '511922' + }, + { + city: '巴中市', + text: '平昌县', + value: '511923' + } + ], + '512000': [ + { + city: '资阳市', + text: '市辖区', + value: '512001' + }, + { + city: '资阳市', + text: '雁江区', + value: '512002' + }, + { + city: '资阳市', + text: '安岳县', + value: '512021' + }, + { + city: '资阳市', + text: '乐至县', + value: '512022' + } + ], + '513200': [ + { + city: '阿坝藏族羌族自治州', + text: '马尔康市', + value: '513201' + }, + { + city: '阿坝藏族羌族自治州', + text: '汶川县', + value: '513221' + }, + { + city: '阿坝藏族羌族自治州', + text: '理县', + value: '513222' + }, + { + city: '阿坝藏族羌族自治州', + text: '茂县', + value: '513223' + }, + { + city: '阿坝藏族羌族自治州', + text: '松潘县', + value: '513224' + }, + { + city: '阿坝藏族羌族自治州', + text: '九寨沟县', + value: '513225' + }, + { + city: '阿坝藏族羌族自治州', + text: '金川县', + value: '513226' + }, + { + city: '阿坝藏族羌族自治州', + text: '小金县', + value: '513227' + }, + { + city: '阿坝藏族羌族自治州', + text: '黑水县', + value: '513228' + }, + { + city: '阿坝藏族羌族自治州', + text: '壤塘县', + value: '513230' + }, + { + city: '阿坝藏族羌族自治州', + text: '阿坝县', + value: '513231' + }, + { + city: '阿坝藏族羌族自治州', + text: '若尔盖县', + value: '513232' + }, + { + city: '阿坝藏族羌族自治州', + text: '红原县', + value: '513233' + } + ], + '513300': [ + { + city: '甘孜藏族自治州', + text: '康定市', + value: '513301' + }, + { + city: '甘孜藏族自治州', + text: '泸定县', + value: '513322' + }, + { + city: '甘孜藏族自治州', + text: '丹巴县', + value: '513323' + }, + { + city: '甘孜藏族自治州', + text: '九龙县', + value: '513324' + }, + { + city: '甘孜藏族自治州', + text: '雅江县', + value: '513325' + }, + { + city: '甘孜藏族自治州', + text: '道孚县', + value: '513326' + }, + { + city: '甘孜藏族自治州', + text: '炉霍县', + value: '513327' + }, + { + city: '甘孜藏族自治州', + text: '甘孜县', + value: '513328' + }, + { + city: '甘孜藏族自治州', + text: '新龙县', + value: '513329' + }, + { + city: '甘孜藏族自治州', + text: '德格县', + value: '513330' + }, + { + city: '甘孜藏族自治州', + text: '白玉县', + value: '513331' + }, + { + city: '甘孜藏族自治州', + text: '石渠县', + value: '513332' + }, + { + city: '甘孜藏族自治州', + text: '色达县', + value: '513333' + }, + { + city: '甘孜藏族自治州', + text: '理塘县', + value: '513334' + }, + { + city: '甘孜藏族自治州', + text: '巴塘县', + value: '513335' + }, + { + city: '甘孜藏族自治州', + text: '乡城县', + value: '513336' + }, + { + city: '甘孜藏族自治州', + text: '稻城县', + value: '513337' + }, + { + city: '甘孜藏族自治州', + text: '得荣县', + value: '513338' + } + ], + '513400': [ + { + city: '凉山彝族自治州', + text: '西昌市', + value: '513401' + }, + { + city: '凉山彝族自治州', + text: '木里藏族自治县', + value: '513422' + }, + { + city: '凉山彝族自治州', + text: '盐源县', + value: '513423' + }, + { + city: '凉山彝族自治州', + text: '德昌县', + value: '513424' + }, + { + city: '凉山彝族自治州', + text: '会理县', + value: '513425' + }, + { + city: '凉山彝族自治州', + text: '会东县', + value: '513426' + }, + { + city: '凉山彝族自治州', + text: '宁南县', + value: '513427' + }, + { + city: '凉山彝族自治州', + text: '普格县', + value: '513428' + }, + { + city: '凉山彝族自治州', + text: '布拖县', + value: '513429' + }, + { + city: '凉山彝族自治州', + text: '金阳县', + value: '513430' + }, + { + city: '凉山彝族自治州', + text: '昭觉县', + value: '513431' + }, + { + city: '凉山彝族自治州', + text: '喜德县', + value: '513432' + }, + { + city: '凉山彝族自治州', + text: '冕宁县', + value: '513433' + }, + { + city: '凉山彝族自治州', + text: '越西县', + value: '513434' + }, + { + city: '凉山彝族自治州', + text: '甘洛县', + value: '513435' + }, + { + city: '凉山彝族自治州', + text: '美姑县', + value: '513436' + }, + { + city: '凉山彝族自治州', + text: '雷波县', + value: '513437' + } + ], + '520100': [ + { + city: '贵阳市', + text: '市辖区', + value: '520101' + }, + { + city: '贵阳市', + text: '南明区', + value: '520102' + }, + { + city: '贵阳市', + text: '云岩区', + value: '520103' + }, + { + city: '贵阳市', + text: '花溪区', + value: '520111' + }, + { + city: '贵阳市', + text: '乌当区', + value: '520112' + }, + { + city: '贵阳市', + text: '白云区', + value: '520113' + }, + { + city: '贵阳市', + text: '观山湖区', + value: '520115' + }, + { + city: '贵阳市', + text: '开阳县', + value: '520121' + }, + { + city: '贵阳市', + text: '息烽县', + value: '520122' + }, + { + city: '贵阳市', + text: '修文县', + value: '520123' + }, + { + city: '贵阳市', + text: '清镇市', + value: '520181' + } + ], + '520200': [ + { + city: '六盘水市', + text: '钟山区', + value: '520201' + }, + { + city: '六盘水市', + text: '六枝特区', + value: '520203' + }, + { + city: '六盘水市', + text: '水城县', + value: '520221' + }, + { + city: '六盘水市', + text: '盘县', + value: '520222' + } + ], + '520300': [ + { + city: '遵义市', + text: '市辖区', + value: '520301' + }, + { + city: '遵义市', + text: '红花岗区', + value: '520302' + }, + { + city: '遵义市', + text: '汇川区', + value: '520303' + }, + { + city: '遵义市', + text: '播州区', + value: '520304' + }, + { + city: '遵义市', + text: '桐梓县', + value: '520322' + }, + { + city: '遵义市', + text: '绥阳县', + value: '520323' + }, + { + city: '遵义市', + text: '正安县', + value: '520324' + }, + { + city: '遵义市', + text: '道真仡佬族苗族自治县', + value: '520325' + }, + { + city: '遵义市', + text: '务川仡佬族苗族自治县', + value: '520326' + }, + { + city: '遵义市', + text: '凤冈县', + value: '520327' + }, + { + city: '遵义市', + text: '湄潭县', + value: '520328' + }, + { + city: '遵义市', + text: '余庆县', + value: '520329' + }, + { + city: '遵义市', + text: '习水县', + value: '520330' + }, + { + city: '遵义市', + text: '赤水市', + value: '520381' + }, + { + city: '遵义市', + text: '仁怀市', + value: '520382' + } + ], + '520400': [ + { + city: '安顺市', + text: '市辖区', + value: '520401' + }, + { + city: '安顺市', + text: '西秀区', + value: '520402' + }, + { + city: '安顺市', + text: '平坝区', + value: '520403' + }, + { + city: '安顺市', + text: '普定县', + value: '520422' + }, + { + city: '安顺市', + text: '镇宁布依族苗族自治县', + value: '520423' + }, + { + city: '安顺市', + text: '关岭布依族苗族自治县', + value: '520424' + }, + { + city: '安顺市', + text: '紫云苗族布依族自治县', + value: '520425' + } + ], + '520500': [ + { + city: '毕节市', + text: '市辖区', + value: '520501' + }, + { + city: '毕节市', + text: '七星关区', + value: '520502' + }, + { + city: '毕节市', + text: '大方县', + value: '520521' + }, + { + city: '毕节市', + text: '黔西县', + value: '520522' + }, + { + city: '毕节市', + text: '金沙县', + value: '520523' + }, + { + city: '毕节市', + text: '织金县', + value: '520524' + }, + { + city: '毕节市', + text: '纳雍县', + value: '520525' + }, + { + city: '毕节市', + text: '威宁彝族回族苗族自治县', + value: '520526' + }, + { + city: '毕节市', + text: '赫章县', + value: '520527' + } + ], + '520600': [ + { + city: '铜仁市', + text: '市辖区', + value: '520601' + }, + { + city: '铜仁市', + text: '碧江区', + value: '520602' + }, + { + city: '铜仁市', + text: '万山区', + value: '520603' + }, + { + city: '铜仁市', + text: '江口县', + value: '520621' + }, + { + city: '铜仁市', + text: '玉屏侗族自治县', + value: '520622' + }, + { + city: '铜仁市', + text: '石阡县', + value: '520623' + }, + { + city: '铜仁市', + text: '思南县', + value: '520624' + }, + { + city: '铜仁市', + text: '印江土家族苗族自治县', + value: '520625' + }, + { + city: '铜仁市', + text: '德江县', + value: '520626' + }, + { + city: '铜仁市', + text: '沿河土家族自治县', + value: '520627' + }, + { + city: '铜仁市', + text: '松桃苗族自治县', + value: '520628' + } + ], + '522300': [ + { + city: '黔西南布依族苗族自治州', + text: '兴义市', + value: '522301' + }, + { + city: '黔西南布依族苗族自治州', + text: '兴仁县', + value: '522322' + }, + { + city: '黔西南布依族苗族自治州', + text: '普安县', + value: '522323' + }, + { + city: '黔西南布依族苗族自治州', + text: '晴隆县', + value: '522324' + }, + { + city: '黔西南布依族苗族自治州', + text: '贞丰县', + value: '522325' + }, + { + city: '黔西南布依族苗族自治州', + text: '望谟县', + value: '522326' + }, + { + city: '黔西南布依族苗族自治州', + text: '册亨县', + value: '522327' + }, + { + city: '黔西南布依族苗族自治州', + text: '安龙县', + value: '522328' + } + ], + '522600': [ + { + city: '黔东南苗族侗族自治州', + text: '凯里市', + value: '522601' + }, + { + city: '黔东南苗族侗族自治州', + text: '黄平县', + value: '522622' + }, + { + city: '黔东南苗族侗族自治州', + text: '施秉县', + value: '522623' + }, + { + city: '黔东南苗族侗族自治州', + text: '三穗县', + value: '522624' + }, + { + city: '黔东南苗族侗族自治州', + text: '镇远县', + value: '522625' + }, + { + city: '黔东南苗族侗族自治州', + text: '岑巩县', + value: '522626' + }, + { + city: '黔东南苗族侗族自治州', + text: '天柱县', + value: '522627' + }, + { + city: '黔东南苗族侗族自治州', + text: '锦屏县', + value: '522628' + }, + { + city: '黔东南苗族侗族自治州', + text: '剑河县', + value: '522629' + }, + { + city: '黔东南苗族侗族自治州', + text: '台江县', + value: '522630' + }, + { + city: '黔东南苗族侗族自治州', + text: '黎平县', + value: '522631' + }, + { + city: '黔东南苗族侗族自治州', + text: '榕江县', + value: '522632' + }, + { + city: '黔东南苗族侗族自治州', + text: '从江县', + value: '522633' + }, + { + city: '黔东南苗族侗族自治州', + text: '雷山县', + value: '522634' + }, + { + city: '黔东南苗族侗族自治州', + text: '麻江县', + value: '522635' + }, + { + city: '黔东南苗族侗族自治州', + text: '丹寨县', + value: '522636' + } + ], + '522700': [ + { + city: '黔南布依族苗族自治州', + text: '都匀市', + value: '522701' + }, + { + city: '黔南布依族苗族自治州', + text: '福泉市', + value: '522702' + }, + { + city: '黔南布依族苗族自治州', + text: '荔波县', + value: '522722' + }, + { + city: '黔南布依族苗族自治州', + text: '贵定县', + value: '522723' + }, + { + city: '黔南布依族苗族自治州', + text: '瓮安县', + value: '522725' + }, + { + city: '黔南布依族苗族自治州', + text: '独山县', + value: '522726' + }, + { + city: '黔南布依族苗族自治州', + text: '平塘县', + value: '522727' + }, + { + city: '黔南布依族苗族自治州', + text: '罗甸县', + value: '522728' + }, + { + city: '黔南布依族苗族自治州', + text: '长顺县', + value: '522729' + }, + { + city: '黔南布依族苗族自治州', + text: '龙里县', + value: '522730' + }, + { + city: '黔南布依族苗族自治州', + text: '惠水县', + value: '522731' + }, + { + city: '黔南布依族苗族自治州', + text: '三都水族自治县', + value: '522732' + } + ], + '530100': [ + { + city: '昆明市', + text: '市辖区', + value: '530101' + }, + { + city: '昆明市', + text: '五华区', + value: '530102' + }, + { + city: '昆明市', + text: '盘龙区', + value: '530103' + }, + { + city: '昆明市', + text: '官渡区', + value: '530111' + }, + { + city: '昆明市', + text: '西山区', + value: '530112' + }, + { + city: '昆明市', + text: '东川区', + value: '530113' + }, + { + city: '昆明市', + text: '呈贡区', + value: '530114' + }, + { + city: '昆明市', + text: '晋宁县', + value: '530122' + }, + { + city: '昆明市', + text: '富民县', + value: '530124' + }, + { + city: '昆明市', + text: '宜良县', + value: '530125' + }, + { + city: '昆明市', + text: '石林彝族自治县', + value: '530126' + }, + { + city: '昆明市', + text: '嵩明县', + value: '530127' + }, + { + city: '昆明市', + text: '禄劝彝族苗族自治县', + value: '530128' + }, + { + city: '昆明市', + text: '寻甸回族彝族自治县', + value: '530129' + }, + { + city: '昆明市', + text: '安宁市', + value: '530181' + } + ], + '530300': [ + { + city: '曲靖市', + text: '市辖区', + value: '530301' + }, + { + city: '曲靖市', + text: '麒麟区', + value: '530302' + }, + { + city: '曲靖市', + text: '沾益区', + value: '530303' + }, + { + city: '曲靖市', + text: '马龙县', + value: '530321' + }, + { + city: '曲靖市', + text: '陆良县', + value: '530322' + }, + { + city: '曲靖市', + text: '师宗县', + value: '530323' + }, + { + city: '曲靖市', + text: '罗平县', + value: '530324' + }, + { + city: '曲靖市', + text: '富源县', + value: '530325' + }, + { + city: '曲靖市', + text: '会泽县', + value: '530326' + }, + { + city: '曲靖市', + text: '宣威市', + value: '530381' + } + ], + '530400': [ + { + city: '玉溪市', + text: '市辖区', + value: '530401' + }, + { + city: '玉溪市', + text: '红塔区', + value: '530402' + }, + { + city: '玉溪市', + text: '江川区', + value: '530403' + }, + { + city: '玉溪市', + text: '澄江县', + value: '530422' + }, + { + city: '玉溪市', + text: '通海县', + value: '530423' + }, + { + city: '玉溪市', + text: '华宁县', + value: '530424' + }, + { + city: '玉溪市', + text: '易门县', + value: '530425' + }, + { + city: '玉溪市', + text: '峨山彝族自治县', + value: '530426' + }, + { + city: '玉溪市', + text: '新平彝族傣族自治县', + value: '530427' + }, + { + city: '玉溪市', + text: '元江哈尼族彝族傣族自治县', + value: '530428' + } + ], + '530500': [ + { + city: '保山市', + text: '市辖区', + value: '530501' + }, + { + city: '保山市', + text: '隆阳区', + value: '530502' + }, + { + city: '保山市', + text: '施甸县', + value: '530521' + }, + { + city: '保山市', + text: '龙陵县', + value: '530523' + }, + { + city: '保山市', + text: '昌宁县', + value: '530524' + }, + { + city: '保山市', + text: '腾冲市', + value: '530581' + } + ], + '530600': [ + { + city: '昭通市', + text: '市辖区', + value: '530601' + }, + { + city: '昭通市', + text: '昭阳区', + value: '530602' + }, + { + city: '昭通市', + text: '鲁甸县', + value: '530621' + }, + { + city: '昭通市', + text: '巧家县', + value: '530622' + }, + { + city: '昭通市', + text: '盐津县', + value: '530623' + }, + { + city: '昭通市', + text: '大关县', + value: '530624' + }, + { + city: '昭通市', + text: '永善县', + value: '530625' + }, + { + city: '昭通市', + text: '绥江县', + value: '530626' + }, + { + city: '昭通市', + text: '镇雄县', + value: '530627' + }, + { + city: '昭通市', + text: '彝良县', + value: '530628' + }, + { + city: '昭通市', + text: '威信县', + value: '530629' + }, + { + city: '昭通市', + text: '水富县', + value: '530630' + } + ], + '530700': [ + { + city: '丽江市', + text: '市辖区', + value: '530701' + }, + { + city: '丽江市', + text: '古城区', + value: '530702' + }, + { + city: '丽江市', + text: '玉龙纳西族自治县', + value: '530721' + }, + { + city: '丽江市', + text: '永胜县', + value: '530722' + }, + { + city: '丽江市', + text: '华坪县', + value: '530723' + }, + { + city: '丽江市', + text: '宁蒗彝族自治县', + value: '530724' + } + ], + '530800': [ + { + city: '普洱市', + text: '市辖区', + value: '530801' + }, + { + city: '普洱市', + text: '思茅区', + value: '530802' + }, + { + city: '普洱市', + text: '宁洱哈尼族彝族自治县', + value: '530821' + }, + { + city: '普洱市', + text: '墨江哈尼族自治县', + value: '530822' + }, + { + city: '普洱市', + text: '景东彝族自治县', + value: '530823' + }, + { + city: '普洱市', + text: '景谷傣族彝族自治县', + value: '530824' + }, + { + city: '普洱市', + text: '镇沅彝族哈尼族拉祜族自治县', + value: '530825' + }, + { + city: '普洱市', + text: '江城哈尼族彝族自治县', + value: '530826' + }, + { + city: '普洱市', + text: '孟连傣族拉祜族佤族自治县', + value: '530827' + }, + { + city: '普洱市', + text: '澜沧拉祜族自治县', + value: '530828' + }, + { + city: '普洱市', + text: '西盟佤族自治县', + value: '530829' + } + ], + '530900': [ + { + city: '临沧市', + text: '市辖区', + value: '530901' + }, + { + city: '临沧市', + text: '临翔区', + value: '530902' + }, + { + city: '临沧市', + text: '凤庆县', + value: '530921' + }, + { + city: '临沧市', + text: '云县', + value: '530922' + }, + { + city: '临沧市', + text: '永德县', + value: '530923' + }, + { + city: '临沧市', + text: '镇康县', + value: '530924' + }, + { + city: '临沧市', + text: '双江拉祜族佤族布朗族傣族自治县', + value: '530925' + }, + { + city: '临沧市', + text: '耿马傣族佤族自治县', + value: '530926' + }, + { + city: '临沧市', + text: '沧源佤族自治县', + value: '530927' + } + ], + '532300': [ + { + city: '楚雄彝族自治州', + text: '楚雄市', + value: '532301' + }, + { + city: '楚雄彝族自治州', + text: '双柏县', + value: '532322' + }, + { + city: '楚雄彝族自治州', + text: '牟定县', + value: '532323' + }, + { + city: '楚雄彝族自治州', + text: '南华县', + value: '532324' + }, + { + city: '楚雄彝族自治州', + text: '姚安县', + value: '532325' + }, + { + city: '楚雄彝族自治州', + text: '大姚县', + value: '532326' + }, + { + city: '楚雄彝族自治州', + text: '永仁县', + value: '532327' + }, + { + city: '楚雄彝族自治州', + text: '元谋县', + value: '532328' + }, + { + city: '楚雄彝族自治州', + text: '武定县', + value: '532329' + }, + { + city: '楚雄彝族自治州', + text: '禄丰县', + value: '532331' + } + ], + '532500': [ + { + city: '红河哈尼族彝族自治州', + text: '个旧市', + value: '532501' + }, + { + city: '红河哈尼族彝族自治州', + text: '开远市', + value: '532502' + }, + { + city: '红河哈尼族彝族自治州', + text: '蒙自市', + value: '532503' + }, + { + city: '红河哈尼族彝族自治州', + text: '弥勒市', + value: '532504' + }, + { + city: '红河哈尼族彝族自治州', + text: '屏边苗族自治县', + value: '532523' + }, + { + city: '红河哈尼族彝族自治州', + text: '建水县', + value: '532524' + }, + { + city: '红河哈尼族彝族自治州', + text: '石屏县', + value: '532525' + }, + { + city: '红河哈尼族彝族自治州', + text: '泸西县', + value: '532527' + }, + { + city: '红河哈尼族彝族自治州', + text: '元阳县', + value: '532528' + }, + { + city: '红河哈尼族彝族自治州', + text: '红河县', + value: '532529' + }, + { + city: '红河哈尼族彝族自治州', + text: '金平苗族瑶族傣族自治县', + value: '532530' + }, + { + city: '红河哈尼族彝族自治州', + text: '绿春县', + value: '532531' + }, + { + city: '红河哈尼族彝族自治州', + text: '河口瑶族自治县', + value: '532532' + } + ], + '532600': [ + { + city: '文山壮族苗族自治州', + text: '文山市', + value: '532601' + }, + { + city: '文山壮族苗族自治州', + text: '砚山县', + value: '532622' + }, + { + city: '文山壮族苗族自治州', + text: '西畴县', + value: '532623' + }, + { + city: '文山壮族苗族自治州', + text: '麻栗坡县', + value: '532624' + }, + { + city: '文山壮族苗族自治州', + text: '马关县', + value: '532625' + }, + { + city: '文山壮族苗族自治州', + text: '丘北县', + value: '532626' + }, + { + city: '文山壮族苗族自治州', + text: '广南县', + value: '532627' + }, + { + city: '文山壮族苗族自治州', + text: '富宁县', + value: '532628' + } + ], + '532800': [ + { + city: '西双版纳傣族自治州', + text: '景洪市', + value: '532801' + }, + { + city: '西双版纳傣族自治州', + text: '勐海县', + value: '532822' + }, + { + city: '西双版纳傣族自治州', + text: '勐腊县', + value: '532823' + } + ], + '532900': [ + { + city: '大理白族自治州', + text: '大理市', + value: '532901' + }, + { + city: '大理白族自治州', + text: '漾濞彝族自治县', + value: '532922' + }, + { + city: '大理白族自治州', + text: '祥云县', + value: '532923' + }, + { + city: '大理白族自治州', + text: '宾川县', + value: '532924' + }, + { + city: '大理白族自治州', + text: '弥渡县', + value: '532925' + }, + { + city: '大理白族自治州', + text: '南涧彝族自治县', + value: '532926' + }, + { + city: '大理白族自治州', + text: '巍山彝族回族自治县', + value: '532927' + }, + { + city: '大理白族自治州', + text: '永平县', + value: '532928' + }, + { + city: '大理白族自治州', + text: '云龙县', + value: '532929' + }, + { + city: '大理白族自治州', + text: '洱源县', + value: '532930' + }, + { + city: '大理白族自治州', + text: '剑川县', + value: '532931' + }, + { + city: '大理白族自治州', + text: '鹤庆县', + value: '532932' + } + ], + '533100': [ + { + city: '德宏傣族景颇族自治州', + text: '瑞丽市', + value: '533102' + }, + { + city: '德宏傣族景颇族自治州', + text: '芒市', + value: '533103' + }, + { + city: '德宏傣族景颇族自治州', + text: '梁河县', + value: '533122' + }, + { + city: '德宏傣族景颇族自治州', + text: '盈江县', + value: '533123' + }, + { + city: '德宏傣族景颇族自治州', + text: '陇川县', + value: '533124' + } + ], + '533300': [ + { + city: '怒江傈僳族自治州', + text: '泸水市', + value: '533301' + }, + { + city: '怒江傈僳族自治州', + text: '福贡县', + value: '533323' + }, + { + city: '怒江傈僳族自治州', + text: '贡山独龙族怒族自治县', + value: '533324' + }, + { + city: '怒江傈僳族自治州', + text: '兰坪白族普米族自治县', + value: '533325' + } + ], + '533400': [ + { + city: '迪庆藏族自治州', + text: '香格里拉市', + value: '533401' + }, + { + city: '迪庆藏族自治州', + text: '德钦县', + value: '533422' + }, + { + city: '迪庆藏族自治州', + text: '维西傈僳族自治县', + value: '533423' + } + ], + '540100': [ + { + city: '拉萨市', + text: '市辖区', + value: '540101' + }, + { + city: '拉萨市', + text: '城关区', + value: '540102' + }, + { + city: '拉萨市', + text: '堆龙德庆区', + value: '540103' + }, + { + city: '拉萨市', + text: '林周县', + value: '540121' + }, + { + city: '拉萨市', + text: '当雄县', + value: '540122' + }, + { + city: '拉萨市', + text: '尼木县', + value: '540123' + }, + { + city: '拉萨市', + text: '曲水县', + value: '540124' + }, + { + city: '拉萨市', + text: '达孜县', + value: '540126' + }, + { + city: '拉萨市', + text: '墨竹工卡县', + value: '540127' + } + ], + '540200': [ + { + city: '日喀则市', + text: '桑珠孜区', + value: '540202' + }, + { + city: '日喀则市', + text: '南木林县', + value: '540221' + }, + { + city: '日喀则市', + text: '江孜县', + value: '540222' + }, + { + city: '日喀则市', + text: '定日县', + value: '540223' + }, + { + city: '日喀则市', + text: '萨迦县', + value: '540224' + }, + { + city: '日喀则市', + text: '拉孜县', + value: '540225' + }, + { + city: '日喀则市', + text: '昂仁县', + value: '540226' + }, + { + city: '日喀则市', + text: '谢通门县', + value: '540227' + }, + { + city: '日喀则市', + text: '白朗县', + value: '540228' + }, + { + city: '日喀则市', + text: '仁布县', + value: '540229' + }, + { + city: '日喀则市', + text: '康马县', + value: '540230' + }, + { + city: '日喀则市', + text: '定结县', + value: '540231' + }, + { + city: '日喀则市', + text: '仲巴县', + value: '540232' + }, + { + city: '日喀则市', + text: '亚东县', + value: '540233' + }, + { + city: '日喀则市', + text: '吉隆县', + value: '540234' + }, + { + city: '日喀则市', + text: '聂拉木县', + value: '540235' + }, + { + city: '日喀则市', + text: '萨嘎县', + value: '540236' + }, + { + city: '日喀则市', + text: '岗巴县', + value: '540237' + } + ], + '540300': [ + { + city: '昌都市', + text: '卡若区', + value: '540302' + }, + { + city: '昌都市', + text: '江达县', + value: '540321' + }, + { + city: '昌都市', + text: '贡觉县', + value: '540322' + }, + { + city: '昌都市', + text: '类乌齐县', + value: '540323' + }, + { + city: '昌都市', + text: '丁青县', + value: '540324' + }, + { + city: '昌都市', + text: '察雅县', + value: '540325' + }, + { + city: '昌都市', + text: '八宿县', + value: '540326' + }, + { + city: '昌都市', + text: '左贡县', + value: '540327' + }, + { + city: '昌都市', + text: '芒康县', + value: '540328' + }, + { + city: '昌都市', + text: '洛隆县', + value: '540329' + }, + { + city: '昌都市', + text: '边坝县', + value: '540330' + } + ], + '540400': [ + { + city: '林芝市', + text: '巴宜区', + value: '540402' + }, + { + city: '林芝市', + text: '工布江达县', + value: '540421' + }, + { + city: '林芝市', + text: '米林县', + value: '540422' + }, + { + city: '林芝市', + text: '墨脱县', + value: '540423' + }, + { + city: '林芝市', + text: '波密县', + value: '540424' + }, + { + city: '林芝市', + text: '察隅县', + value: '540425' + }, + { + city: '林芝市', + text: '朗县', + value: '540426' + } + ], + '540500': [ + { + city: '山南市', + text: '市辖区', + value: '540501' + }, + { + city: '山南市', + text: '乃东区', + value: '540502' + }, + { + city: '山南市', + text: '扎囊县', + value: '540521' + }, + { + city: '山南市', + text: '贡嘎县', + value: '540522' + }, + { + city: '山南市', + text: '桑日县', + value: '540523' + }, + { + city: '山南市', + text: '琼结县', + value: '540524' + }, + { + city: '山南市', + text: '曲松县', + value: '540525' + }, + { + city: '山南市', + text: '措美县', + value: '540526' + }, + { + city: '山南市', + text: '洛扎县', + value: '540527' + }, + { + city: '山南市', + text: '加查县', + value: '540528' + }, + { + city: '山南市', + text: '隆子县', + value: '540529' + }, + { + city: '山南市', + text: '错那县', + value: '540530' + }, + { + city: '山南市', + text: '浪卡子县', + value: '540531' + } + ], + '542400': [ + { + city: '那曲地区', + text: '那曲县', + value: '542421' + }, + { + city: '那曲地区', + text: '嘉黎县', + value: '542422' + }, + { + city: '那曲地区', + text: '比如县', + value: '542423' + }, + { + city: '那曲地区', + text: '聂荣县', + value: '542424' + }, + { + city: '那曲地区', + text: '安多县', + value: '542425' + }, + { + city: '那曲地区', + text: '申扎县', + value: '542426' + }, + { + city: '那曲地区', + text: '索县', + value: '542427' + }, + { + city: '那曲地区', + text: '班戈县', + value: '542428' + }, + { + city: '那曲地区', + text: '巴青县', + value: '542429' + }, + { + city: '那曲地区', + text: '尼玛县', + value: '542430' + }, + { + city: '那曲地区', + text: '双湖县', + value: '542431' + } + ], + '542500': [ + { + city: '阿里地区', + text: '普兰县', + value: '542521' + }, + { + city: '阿里地区', + text: '札达县', + value: '542522' + }, + { + city: '阿里地区', + text: '噶尔县', + value: '542523' + }, + { + city: '阿里地区', + text: '日土县', + value: '542524' + }, + { + city: '阿里地区', + text: '革吉县', + value: '542525' + }, + { + city: '阿里地区', + text: '改则县', + value: '542526' + }, + { + city: '阿里地区', + text: '措勤县', + value: '542527' + } + ], + '610100': [ + { + city: '西安市', + text: '市辖区', + value: '610101' + }, + { + city: '西安市', + text: '新城区', + value: '610102' + }, + { + city: '西安市', + text: '碑林区', + value: '610103' + }, + { + city: '西安市', + text: '莲湖区', + value: '610104' + }, + { + city: '西安市', + text: '灞桥区', + value: '610111' + }, + { + city: '西安市', + text: '未央区', + value: '610112' + }, + { + city: '西安市', + text: '雁塔区', + value: '610113' + }, + { + city: '西安市', + text: '阎良区', + value: '610114' + }, + { + city: '西安市', + text: '临潼区', + value: '610115' + }, + { + city: '西安市', + text: '长安区', + value: '610116' + }, + { + city: '西安市', + text: '高陵区', + value: '610117' + }, + { + city: '西安市', + text: '蓝田县', + value: '610122' + }, + { + city: '西安市', + text: '周至县', + value: '610124' + }, + { + city: '西安市', + text: '户县', + value: '610125' + } + ], + '610200': [ + { + city: '铜川市', + text: '市辖区', + value: '610201' + }, + { + city: '铜川市', + text: '王益区', + value: '610202' + }, + { + city: '铜川市', + text: '印台区', + value: '610203' + }, + { + city: '铜川市', + text: '耀州区', + value: '610204' + }, + { + city: '铜川市', + text: '宜君县', + value: '610222' + } + ], + '610300': [ + { + city: '宝鸡市', + text: '市辖区', + value: '610301' + }, + { + city: '宝鸡市', + text: '渭滨区', + value: '610302' + }, + { + city: '宝鸡市', + text: '金台区', + value: '610303' + }, + { + city: '宝鸡市', + text: '陈仓区', + value: '610304' + }, + { + city: '宝鸡市', + text: '凤翔县', + value: '610322' + }, + { + city: '宝鸡市', + text: '岐山县', + value: '610323' + }, + { + city: '宝鸡市', + text: '扶风县', + value: '610324' + }, + { + city: '宝鸡市', + text: '眉县', + value: '610326' + }, + { + city: '宝鸡市', + text: '陇县', + value: '610327' + }, + { + city: '宝鸡市', + text: '千阳县', + value: '610328' + }, + { + city: '宝鸡市', + text: '麟游县', + value: '610329' + }, + { + city: '宝鸡市', + text: '凤县', + value: '610330' + }, + { + city: '宝鸡市', + text: '太白县', + value: '610331' + } + ], + '610400': [ + { + city: '咸阳市', + text: '市辖区', + value: '610401' + }, + { + city: '咸阳市', + text: '秦都区', + value: '610402' + }, + { + city: '咸阳市', + text: '杨陵区', + value: '610403' + }, + { + city: '咸阳市', + text: '渭城区', + value: '610404' + }, + { + city: '咸阳市', + text: '三原县', + value: '610422' + }, + { + city: '咸阳市', + text: '泾阳县', + value: '610423' + }, + { + city: '咸阳市', + text: '乾县', + value: '610424' + }, + { + city: '咸阳市', + text: '礼泉县', + value: '610425' + }, + { + city: '咸阳市', + text: '永寿县', + value: '610426' + }, + { + city: '咸阳市', + text: '彬县', + value: '610427' + }, + { + city: '咸阳市', + text: '长武县', + value: '610428' + }, + { + city: '咸阳市', + text: '旬邑县', + value: '610429' + }, + { + city: '咸阳市', + text: '淳化县', + value: '610430' + }, + { + city: '咸阳市', + text: '武功县', + value: '610431' + }, + { + city: '咸阳市', + text: '兴平市', + value: '610481' + } + ], + '610500': [ + { + city: '渭南市', + text: '市辖区', + value: '610501' + }, + { + city: '渭南市', + text: '临渭区', + value: '610502' + }, + { + city: '渭南市', + text: '华州区', + value: '610503' + }, + { + city: '渭南市', + text: '潼关县', + value: '610522' + }, + { + city: '渭南市', + text: '大荔县', + value: '610523' + }, + { + city: '渭南市', + text: '合阳县', + value: '610524' + }, + { + city: '渭南市', + text: '澄城县', + value: '610525' + }, + { + city: '渭南市', + text: '蒲城县', + value: '610526' + }, + { + city: '渭南市', + text: '白水县', + value: '610527' + }, + { + city: '渭南市', + text: '富平县', + value: '610528' + }, + { + city: '渭南市', + text: '韩城市', + value: '610581' + }, + { + city: '渭南市', + text: '华阴市', + value: '610582' + } + ], + '610600': [ + { + city: '延安市', + text: '市辖区', + value: '610601' + }, + { + city: '延安市', + text: '宝塔区', + value: '610602' + }, + { + city: '延安市', + text: '安塞区', + value: '610603' + }, + { + city: '延安市', + text: '延长县', + value: '610621' + }, + { + city: '延安市', + text: '延川县', + value: '610622' + }, + { + city: '延安市', + text: '子长县', + value: '610623' + }, + { + city: '延安市', + text: '志丹县', + value: '610625' + }, + { + city: '延安市', + text: '吴起县', + value: '610626' + }, + { + city: '延安市', + text: '甘泉县', + value: '610627' + }, + { + city: '延安市', + text: '富县', + value: '610628' + }, + { + city: '延安市', + text: '洛川县', + value: '610629' + }, + { + city: '延安市', + text: '宜川县', + value: '610630' + }, + { + city: '延安市', + text: '黄龙县', + value: '610631' + }, + { + city: '延安市', + text: '黄陵县', + value: '610632' + } + ], + '610700': [ + { + city: '汉中市', + text: '市辖区', + value: '610701' + }, + { + city: '汉中市', + text: '汉台区', + value: '610702' + }, + { + city: '汉中市', + text: '南郑县', + value: '610721' + }, + { + city: '汉中市', + text: '城固县', + value: '610722' + }, + { + city: '汉中市', + text: '洋县', + value: '610723' + }, + { + city: '汉中市', + text: '西乡县', + value: '610724' + }, + { + city: '汉中市', + text: '勉县', + value: '610725' + }, + { + city: '汉中市', + text: '宁强县', + value: '610726' + }, + { + city: '汉中市', + text: '略阳县', + value: '610727' + }, + { + city: '汉中市', + text: '镇巴县', + value: '610728' + }, + { + city: '汉中市', + text: '留坝县', + value: '610729' + }, + { + city: '汉中市', + text: '佛坪县', + value: '610730' + } + ], + '610800': [ + { + city: '榆林市', + text: '市辖区', + value: '610801' + }, + { + city: '榆林市', + text: '榆阳区', + value: '610802' + }, + { + city: '榆林市', + text: '横山区', + value: '610803' + }, + { + city: '榆林市', + text: '神木县', + value: '610821' + }, + { + city: '榆林市', + text: '府谷县', + value: '610822' + }, + { + city: '榆林市', + text: '靖边县', + value: '610824' + }, + { + city: '榆林市', + text: '定边县', + value: '610825' + }, + { + city: '榆林市', + text: '绥德县', + value: '610826' + }, + { + city: '榆林市', + text: '米脂县', + value: '610827' + }, + { + city: '榆林市', + text: '佳县', + value: '610828' + }, + { + city: '榆林市', + text: '吴堡县', + value: '610829' + }, + { + city: '榆林市', + text: '清涧县', + value: '610830' + }, + { + city: '榆林市', + text: '子洲县', + value: '610831' + } + ], + '610900': [ + { + city: '安康市', + text: '市辖区', + value: '610901' + }, + { + city: '安康市', + text: '汉滨区', + value: '610902' + }, + { + city: '安康市', + text: '汉阴县', + value: '610921' + }, + { + city: '安康市', + text: '石泉县', + value: '610922' + }, + { + city: '安康市', + text: '宁陕县', + value: '610923' + }, + { + city: '安康市', + text: '紫阳县', + value: '610924' + }, + { + city: '安康市', + text: '岚皋县', + value: '610925' + }, + { + city: '安康市', + text: '平利县', + value: '610926' + }, + { + city: '安康市', + text: '镇坪县', + value: '610927' + }, + { + city: '安康市', + text: '旬阳县', + value: '610928' + }, + { + city: '安康市', + text: '白河县', + value: '610929' + } + ], + '611000': [ + { + city: '商洛市', + text: '市辖区', + value: '611001' + }, + { + city: '商洛市', + text: '商州区', + value: '611002' + }, + { + city: '商洛市', + text: '洛南县', + value: '611021' + }, + { + city: '商洛市', + text: '丹凤县', + value: '611022' + }, + { + city: '商洛市', + text: '商南县', + value: '611023' + }, + { + city: '商洛市', + text: '山阳县', + value: '611024' + }, + { + city: '商洛市', + text: '镇安县', + value: '611025' + }, + { + city: '商洛市', + text: '柞水县', + value: '611026' + } + ], + '620100': [ + { + city: '兰州市', + text: '市辖区', + value: '620101' + }, + { + city: '兰州市', + text: '城关区', + value: '620102' + }, + { + city: '兰州市', + text: '七里河区', + value: '620103' + }, + { + city: '兰州市', + text: '西固区', + value: '620104' + }, + { + city: '兰州市', + text: '安宁区', + value: '620105' + }, + { + city: '兰州市', + text: '红古区', + value: '620111' + }, + { + city: '兰州市', + text: '永登县', + value: '620121' + }, + { + city: '兰州市', + text: '皋兰县', + value: '620122' + }, + { + city: '兰州市', + text: '榆中县', + value: '620123' + } + ], + '620200': [ + { + city: '嘉峪关市', + text: '市辖区', + value: '620201' + } + ], + '620300': [ + { + city: '金昌市', + text: '市辖区', + value: '620301' + }, + { + city: '金昌市', + text: '金川区', + value: '620302' + }, + { + city: '金昌市', + text: '永昌县', + value: '620321' + } + ], + '620400': [ + { + city: '白银市', + text: '市辖区', + value: '620401' + }, + { + city: '白银市', + text: '白银区', + value: '620402' + }, + { + city: '白银市', + text: '平川区', + value: '620403' + }, + { + city: '白银市', + text: '靖远县', + value: '620421' + }, + { + city: '白银市', + text: '会宁县', + value: '620422' + }, + { + city: '白银市', + text: '景泰县', + value: '620423' + } + ], + '620500': [ + { + city: '天水市', + text: '市辖区', + value: '620501' + }, + { + city: '天水市', + text: '秦州区', + value: '620502' + }, + { + city: '天水市', + text: '麦积区', + value: '620503' + }, + { + city: '天水市', + text: '清水县', + value: '620521' + }, + { + city: '天水市', + text: '秦安县', + value: '620522' + }, + { + city: '天水市', + text: '甘谷县', + value: '620523' + }, + { + city: '天水市', + text: '武山县', + value: '620524' + }, + { + city: '天水市', + text: '张家川回族自治县', + value: '620525' + } + ], + '620600': [ + { + city: '武威市', + text: '市辖区', + value: '620601' + }, + { + city: '武威市', + text: '凉州区', + value: '620602' + }, + { + city: '武威市', + text: '民勤县', + value: '620621' + }, + { + city: '武威市', + text: '古浪县', + value: '620622' + }, + { + city: '武威市', + text: '天祝藏族自治县', + value: '620623' + } + ], + '620700': [ + { + city: '张掖市', + text: '市辖区', + value: '620701' + }, + { + city: '张掖市', + text: '甘州区', + value: '620702' + }, + { + city: '张掖市', + text: '肃南裕固族自治县', + value: '620721' + }, + { + city: '张掖市', + text: '民乐县', + value: '620722' + }, + { + city: '张掖市', + text: '临泽县', + value: '620723' + }, + { + city: '张掖市', + text: '高台县', + value: '620724' + }, + { + city: '张掖市', + text: '山丹县', + value: '620725' + } + ], + '620800': [ + { + city: '平凉市', + text: '市辖区', + value: '620801' + }, + { + city: '平凉市', + text: '崆峒区', + value: '620802' + }, + { + city: '平凉市', + text: '泾川县', + value: '620821' + }, + { + city: '平凉市', + text: '灵台县', + value: '620822' + }, + { + city: '平凉市', + text: '崇信县', + value: '620823' + }, + { + city: '平凉市', + text: '华亭县', + value: '620824' + }, + { + city: '平凉市', + text: '庄浪县', + value: '620825' + }, + { + city: '平凉市', + text: '静宁县', + value: '620826' + } + ], + '620900': [ + { + city: '酒泉市', + text: '市辖区', + value: '620901' + }, + { + city: '酒泉市', + text: '肃州区', + value: '620902' + }, + { + city: '酒泉市', + text: '金塔县', + value: '620921' + }, + { + city: '酒泉市', + text: '瓜州县', + value: '620922' + }, + { + city: '酒泉市', + text: '肃北蒙古族自治县', + value: '620923' + }, + { + city: '酒泉市', + text: '阿克塞哈萨克族自治县', + value: '620924' + }, + { + city: '酒泉市', + text: '玉门市', + value: '620981' + }, + { + city: '酒泉市', + text: '敦煌市', + value: '620982' + } + ], + '621000': [ + { + city: '庆阳市', + text: '市辖区', + value: '621001' + }, + { + city: '庆阳市', + text: '西峰区', + value: '621002' + }, + { + city: '庆阳市', + text: '庆城县', + value: '621021' + }, + { + city: '庆阳市', + text: '环县', + value: '621022' + }, + { + city: '庆阳市', + text: '华池县', + value: '621023' + }, + { + city: '庆阳市', + text: '合水县', + value: '621024' + }, + { + city: '庆阳市', + text: '正宁县', + value: '621025' + }, + { + city: '庆阳市', + text: '宁县', + value: '621026' + }, + { + city: '庆阳市', + text: '镇原县', + value: '621027' + } + ], + '621100': [ + { + city: '定西市', + text: '市辖区', + value: '621101' + }, + { + city: '定西市', + text: '安定区', + value: '621102' + }, + { + city: '定西市', + text: '通渭县', + value: '621121' + }, + { + city: '定西市', + text: '陇西县', + value: '621122' + }, + { + city: '定西市', + text: '渭源县', + value: '621123' + }, + { + city: '定西市', + text: '临洮县', + value: '621124' + }, + { + city: '定西市', + text: '漳县', + value: '621125' + }, + { + city: '定西市', + text: '岷县', + value: '621126' + } + ], + '621200': [ + { + city: '陇南市', + text: '市辖区', + value: '621201' + }, + { + city: '陇南市', + text: '武都区', + value: '621202' + }, + { + city: '陇南市', + text: '成县', + value: '621221' + }, + { + city: '陇南市', + text: '文县', + value: '621222' + }, + { + city: '陇南市', + text: '宕昌县', + value: '621223' + }, + { + city: '陇南市', + text: '康县', + value: '621224' + }, + { + city: '陇南市', + text: '西和县', + value: '621225' + }, + { + city: '陇南市', + text: '礼县', + value: '621226' + }, + { + city: '陇南市', + text: '徽县', + value: '621227' + }, + { + city: '陇南市', + text: '两当县', + value: '621228' + } + ], + '622900': [ + { + city: '临夏回族自治州', + text: '临夏市', + value: '622901' + }, + { + city: '临夏回族自治州', + text: '临夏县', + value: '622921' + }, + { + city: '临夏回族自治州', + text: '康乐县', + value: '622922' + }, + { + city: '临夏回族自治州', + text: '永靖县', + value: '622923' + }, + { + city: '临夏回族自治州', + text: '广河县', + value: '622924' + }, + { + city: '临夏回族自治州', + text: '和政县', + value: '622925' + }, + { + city: '临夏回族自治州', + text: '东乡族自治县', + value: '622926' + }, + { + city: '临夏回族自治州', + text: '积石山保安族东乡族撒拉族自治县', + value: '622927' + } + ], + '623000': [ + { + city: '甘南藏族自治州', + text: '合作市', + value: '623001' + }, + { + city: '甘南藏族自治州', + text: '临潭县', + value: '623021' + }, + { + city: '甘南藏族自治州', + text: '卓尼县', + value: '623022' + }, + { + city: '甘南藏族自治州', + text: '舟曲县', + value: '623023' + }, + { + city: '甘南藏族自治州', + text: '迭部县', + value: '623024' + }, + { + city: '甘南藏族自治州', + text: '玛曲县', + value: '623025' + }, + { + city: '甘南藏族自治州', + text: '碌曲县', + value: '623026' + }, + { + city: '甘南藏族自治州', + text: '夏河县', + value: '623027' + } + ], + '630100': [ + { + city: '西宁市', + text: '市辖区', + value: '630101' + }, + { + city: '西宁市', + text: '城东区', + value: '630102' + }, + { + city: '西宁市', + text: '城中区', + value: '630103' + }, + { + city: '西宁市', + text: '城西区', + value: '630104' + }, + { + city: '西宁市', + text: '城北区', + value: '630105' + }, + { + city: '西宁市', + text: '大通回族土族自治县', + value: '630121' + }, + { + city: '西宁市', + text: '湟中县', + value: '630122' + }, + { + city: '西宁市', + text: '湟源县', + value: '630123' + } + ], + '630200': [ + { + city: '海东市', + text: '乐都区', + value: '630202' + }, + { + city: '海东市', + text: '平安区', + value: '630203' + }, + { + city: '海东市', + text: '民和回族土族自治县', + value: '630222' + }, + { + city: '海东市', + text: '互助土族自治县', + value: '630223' + }, + { + city: '海东市', + text: '化隆回族自治县', + value: '630224' + }, + { + city: '海东市', + text: '循化撒拉族自治县', + value: '630225' + } + ], + '632200': [ + { + city: '海北藏族自治州', + text: '门源回族自治县', + value: '632221' + }, + { + city: '海北藏族自治州', + text: '祁连县', + value: '632222' + }, + { + city: '海北藏族自治州', + text: '海晏县', + value: '632223' + }, + { + city: '海北藏族自治州', + text: '刚察县', + value: '632224' + } + ], + '632300': [ + { + city: '黄南藏族自治州', + text: '同仁县', + value: '632321' + }, + { + city: '黄南藏族自治州', + text: '尖扎县', + value: '632322' + }, + { + city: '黄南藏族自治州', + text: '泽库县', + value: '632323' + }, + { + city: '黄南藏族自治州', + text: '河南蒙古族自治县', + value: '632324' + } + ], + '632500': [ + { + city: '海南藏族自治州', + text: '共和县', + value: '632521' + }, + { + city: '海南藏族自治州', + text: '同德县', + value: '632522' + }, + { + city: '海南藏族自治州', + text: '贵德县', + value: '632523' + }, + { + city: '海南藏族自治州', + text: '兴海县', + value: '632524' + }, + { + city: '海南藏族自治州', + text: '贵南县', + value: '632525' + } + ], + '632600': [ + { + city: '果洛藏族自治州', + text: '玛沁县', + value: '632621' + }, + { + city: '果洛藏族自治州', + text: '班玛县', + value: '632622' + }, + { + city: '果洛藏族自治州', + text: '甘德县', + value: '632623' + }, + { + city: '果洛藏族自治州', + text: '达日县', + value: '632624' + }, + { + city: '果洛藏族自治州', + text: '久治县', + value: '632625' + }, + { + city: '果洛藏族自治州', + text: '玛多县', + value: '632626' + } + ], + '632700': [ + { + city: '玉树藏族自治州', + text: '玉树市', + value: '632701' + }, + { + city: '玉树藏族自治州', + text: '杂多县', + value: '632722' + }, + { + city: '玉树藏族自治州', + text: '称多县', + value: '632723' + }, + { + city: '玉树藏族自治州', + text: '治多县', + value: '632724' + }, + { + city: '玉树藏族自治州', + text: '囊谦县', + value: '632725' + }, + { + city: '玉树藏族自治州', + text: '曲麻莱县', + value: '632726' + } + ], + '632800': [ + { + city: '海西蒙古族藏族自治州', + text: '格尔木市', + value: '632801' + }, + { + city: '海西蒙古族藏族自治州', + text: '德令哈市', + value: '632802' + }, + { + city: '海西蒙古族藏族自治州', + text: '乌兰县', + value: '632821' + }, + { + city: '海西蒙古族藏族自治州', + text: '都兰县', + value: '632822' + }, + { + city: '海西蒙古族藏族自治州', + text: '天峻县', + value: '632823' + } + ], + '640100': [ + { + city: '银川市', + text: '市辖区', + value: '640101' + }, + { + city: '银川市', + text: '兴庆区', + value: '640104' + }, + { + city: '银川市', + text: '西夏区', + value: '640105' + }, + { + city: '银川市', + text: '金凤区', + value: '640106' + }, + { + city: '银川市', + text: '永宁县', + value: '640121' + }, + { + city: '银川市', + text: '贺兰县', + value: '640122' + }, + { + city: '银川市', + text: '灵武市', + value: '640181' + } + ], + '640200': [ + { + city: '石嘴山市', + text: '市辖区', + value: '640201' + }, + { + city: '石嘴山市', + text: '大武口区', + value: '640202' + }, + { + city: '石嘴山市', + text: '惠农区', + value: '640205' + }, + { + city: '石嘴山市', + text: '平罗县', + value: '640221' + } + ], + '640300': [ + { + city: '吴忠市', + text: '市辖区', + value: '640301' + }, + { + city: '吴忠市', + text: '利通区', + value: '640302' + }, + { + city: '吴忠市', + text: '红寺堡区', + value: '640303' + }, + { + city: '吴忠市', + text: '盐池县', + value: '640323' + }, + { + city: '吴忠市', + text: '同心县', + value: '640324' + }, + { + city: '吴忠市', + text: '青铜峡市', + value: '640381' + } + ], + '640400': [ + { + city: '固原市', + text: '市辖区', + value: '640401' + }, + { + city: '固原市', + text: '原州区', + value: '640402' + }, + { + city: '固原市', + text: '西吉县', + value: '640422' + }, + { + city: '固原市', + text: '隆德县', + value: '640423' + }, + { + city: '固原市', + text: '泾源县', + value: '640424' + }, + { + city: '固原市', + text: '彭阳县', + value: '640425' + } + ], + '640500': [ + { + city: '中卫市', + text: '市辖区', + value: '640501' + }, + { + city: '中卫市', + text: '沙坡头区', + value: '640502' + }, + { + city: '中卫市', + text: '中宁县', + value: '640521' + }, + { + city: '中卫市', + text: '海原县', + value: '640522' + } + ], + '650100': [ + { + city: '乌鲁木齐市', + text: '市辖区', + value: '650101' + }, + { + city: '乌鲁木齐市', + text: '天山区', + value: '650102' + }, + { + city: '乌鲁木齐市', + text: '沙依巴克区', + value: '650103' + }, + { + city: '乌鲁木齐市', + text: '新市区', + value: '650104' + }, + { + city: '乌鲁木齐市', + text: '水磨沟区', + value: '650105' + }, + { + city: '乌鲁木齐市', + text: '头屯河区', + value: '650106' + }, + { + city: '乌鲁木齐市', + text: '达坂城区', + value: '650107' + }, + { + city: '乌鲁木齐市', + text: '米东区', + value: '650109' + }, + { + city: '乌鲁木齐市', + text: '乌鲁木齐县', + value: '650121' + } + ], + '650200': [ + { + city: '克拉玛依市', + text: '市辖区', + value: '650201' + }, + { + city: '克拉玛依市', + text: '独山子区', + value: '650202' + }, + { + city: '克拉玛依市', + text: '克拉玛依区', + value: '650203' + }, + { + city: '克拉玛依市', + text: '白碱滩区', + value: '650204' + }, + { + city: '克拉玛依市', + text: '乌尔禾区', + value: '650205' + } + ], + '650400': [ + { + city: '吐鲁番市', + text: '高昌区', + value: '650402' + }, + { + city: '吐鲁番市', + text: '鄯善县', + value: '650421' + }, + { + city: '吐鲁番市', + text: '托克逊县', + value: '650422' + } + ], + '650500': [ + { + city: '哈密市', + text: '伊州区', + value: '650502' + }, + { + city: '哈密市', + text: '巴里坤哈萨克自治县', + value: '650521' + }, + { + city: '哈密市', + text: '伊吾县', + value: '650522' + } + ], + '652300': [ + { + city: '昌吉回族自治州', + text: '昌吉市', + value: '652301' + }, + { + city: '昌吉回族自治州', + text: '阜康市', + value: '652302' + }, + { + city: '昌吉回族自治州', + text: '呼图壁县', + value: '652323' + }, + { + city: '昌吉回族自治州', + text: '玛纳斯县', + value: '652324' + }, + { + city: '昌吉回族自治州', + text: '奇台县', + value: '652325' + }, + { + city: '昌吉回族自治州', + text: '吉木萨尔县', + value: '652327' + }, + { + city: '昌吉回族自治州', + text: '木垒哈萨克自治县', + value: '652328' + } + ], + '652700': [ + { + city: '博尔塔拉蒙古自治州', + text: '博乐市', + value: '652701' + }, + { + city: '博尔塔拉蒙古自治州', + text: '阿拉山口市', + value: '652702' + }, + { + city: '博尔塔拉蒙古自治州', + text: '精河县', + value: '652722' + }, + { + city: '博尔塔拉蒙古自治州', + text: '温泉县', + value: '652723' + } + ], + '652800': [ + { + city: '巴音郭楞蒙古自治州', + text: '库尔勒市', + value: '652801' + }, + { + city: '巴音郭楞蒙古自治州', + text: '轮台县', + value: '652822' + }, + { + city: '巴音郭楞蒙古自治州', + text: '尉犁县', + value: '652823' + }, + { + city: '巴音郭楞蒙古自治州', + text: '若羌县', + value: '652824' + }, + { + city: '巴音郭楞蒙古自治州', + text: '且末县', + value: '652825' + }, + { + city: '巴音郭楞蒙古自治州', + text: '焉耆回族自治县', + value: '652826' + }, + { + city: '巴音郭楞蒙古自治州', + text: '和静县', + value: '652827' + }, + { + city: '巴音郭楞蒙古自治州', + text: '和硕县', + value: '652828' + }, + { + city: '巴音郭楞蒙古自治州', + text: '博湖县', + value: '652829' + } + ], + '652900': [ + { + city: '阿克苏地区', + text: '阿克苏市', + value: '652901' + }, + { + city: '阿克苏地区', + text: '温宿县', + value: '652922' + }, + { + city: '阿克苏地区', + text: '库车县', + value: '652923' + }, + { + city: '阿克苏地区', + text: '沙雅县', + value: '652924' + }, + { + city: '阿克苏地区', + text: '新和县', + value: '652925' + }, + { + city: '阿克苏地区', + text: '拜城县', + value: '652926' + }, + { + city: '阿克苏地区', + text: '乌什县', + value: '652927' + }, + { + city: '阿克苏地区', + text: '阿瓦提县', + value: '652928' + }, + { + city: '阿克苏地区', + text: '柯坪县', + value: '652929' + } + ], + '653000': [ + { + city: '克孜勒苏柯尔克孜自治州', + text: '阿图什市', + value: '653001' + }, + { + city: '克孜勒苏柯尔克孜自治州', + text: '阿克陶县', + value: '653022' + }, + { + city: '克孜勒苏柯尔克孜自治州', + text: '阿合奇县', + value: '653023' + }, + { + city: '克孜勒苏柯尔克孜自治州', + text: '乌恰县', + value: '653024' + } + ], + '653100': [ + { + city: '喀什地区', + text: '喀什市', + value: '653101' + }, + { + city: '喀什地区', + text: '疏附县', + value: '653121' + }, + { + city: '喀什地区', + text: '疏勒县', + value: '653122' + }, + { + city: '喀什地区', + text: '英吉沙县', + value: '653123' + }, + { + city: '喀什地区', + text: '泽普县', + value: '653124' + }, + { + city: '喀什地区', + text: '莎车县', + value: '653125' + }, + { + city: '喀什地区', + text: '叶城县', + value: '653126' + }, + { + city: '喀什地区', + text: '麦盖提县', + value: '653127' + }, + { + city: '喀什地区', + text: '岳普湖县', + value: '653128' + }, + { + city: '喀什地区', + text: '伽师县', + value: '653129' + }, + { + city: '喀什地区', + text: '巴楚县', + value: '653130' + }, + { + city: '喀什地区', + text: '塔什库尔干塔吉克自治县', + value: '653131' + } + ], + '653200': [ + { + city: '和田地区', + text: '和田市', + value: '653201' + }, + { + city: '和田地区', + text: '和田县', + value: '653221' + }, + { + city: '和田地区', + text: '墨玉县', + value: '653222' + }, + { + city: '和田地区', + text: '皮山县', + value: '653223' + }, + { + city: '和田地区', + text: '洛浦县', + value: '653224' + }, + { + city: '和田地区', + text: '策勒县', + value: '653225' + }, + { + city: '和田地区', + text: '于田县', + value: '653226' + }, + { + city: '和田地区', + text: '民丰县', + value: '653227' + } + ], + '654000': [ + { + city: '伊犁哈萨克自治州', + text: '伊宁市', + value: '654002' + }, + { + city: '伊犁哈萨克自治州', + text: '奎屯市', + value: '654003' + }, + { + city: '伊犁哈萨克自治州', + text: '霍尔果斯市', + value: '654004' + }, + { + city: '伊犁哈萨克自治州', + text: '伊宁县', + value: '654021' + }, + { + city: '伊犁哈萨克自治州', + text: '察布查尔锡伯自治县', + value: '654022' + }, + { + city: '伊犁哈萨克自治州', + text: '霍城县', + value: '654023' + }, + { + city: '伊犁哈萨克自治州', + text: '巩留县', + value: '654024' + }, + { + city: '伊犁哈萨克自治州', + text: '新源县', + value: '654025' + }, + { + city: '伊犁哈萨克自治州', + text: '昭苏县', + value: '654026' + }, + { + city: '伊犁哈萨克自治州', + text: '特克斯县', + value: '654027' + }, + { + city: '伊犁哈萨克自治州', + text: '尼勒克县', + value: '654028' + } + ], + '654200': [ + { + city: '塔城地区', + text: '塔城市', + value: '654201' + }, + { + city: '塔城地区', + text: '乌苏市', + value: '654202' + }, + { + city: '塔城地区', + text: '额敏县', + value: '654221' + }, + { + city: '塔城地区', + text: '沙湾县', + value: '654223' + }, + { + city: '塔城地区', + text: '托里县', + value: '654224' + }, + { + city: '塔城地区', + text: '裕民县', + value: '654225' + }, + { + city: '塔城地区', + text: '和布克赛尔蒙古自治县', + value: '654226' + } + ], + '654300': [ + { + city: '阿勒泰地区', + text: '阿勒泰市', + value: '654301' + }, + { + city: '阿勒泰地区', + text: '布尔津县', + value: '654321' + }, + { + city: '阿勒泰地区', + text: '富蕴县', + value: '654322' + }, + { + city: '阿勒泰地区', + text: '福海县', + value: '654323' + }, + { + city: '阿勒泰地区', + text: '哈巴河县', + value: '654324' + }, + { + city: '阿勒泰地区', + text: '青河县', + value: '654325' + }, + { + city: '阿勒泰地区', + text: '吉木乃县', + value: '654326' + } + ], + '659000': [ + { + city: '自治区直辖县级行政区划', + text: '石河子市', + value: '659001' + }, + { + city: '自治区直辖县级行政区划', + text: '阿拉尔市', + value: '659002' + }, + { + city: '自治区直辖县级行政区划', + text: '图木舒克市', + value: '659003' + }, + { + city: '自治区直辖县级行政区划', + text: '五家渠市', + value: '659004' + }, + { + city: '自治区直辖县级行政区划', + text: '铁门关市', + value: '659006' + } + ] +} diff --git a/example/data/index-list.json b/example/data/index-list.json new file mode 100644 index 000000000..19f223061 --- /dev/null +++ b/example/data/index-list.json @@ -0,0 +1,171 @@ +[ + { + "name": "★Hot City", + "items": [ + { + "name": "BEIJING", + "value": 1 + }, + { + "name": "SHANGHAI", + "value": 2 + } + ] + }, + { + "name": "A", + "items": [ + { + "name": "ANSHAN", + "value": 3 + }, + { + "name": "ANQING", + "value": 4 + } + ] + }, + { + "name": "B", + "items": [ + { + "name": "BEIJING", + "value": 1 + }, + { + "name": "BAYINGUOLENGZHOU,", + "value": 5 + }, + { + "name": "BOERTALAZHOU", + "value": 6 + } + ] + }, + { + "name": "C", + "items": [ + { + "name": "CHENGDU", + "value": 7 + } + ] + }, + { + "name": "E", + "items": [ + { + "name": "EERDUOSI", + "value": 8 + }, + { + "name": "EZHOU", + "value": 9 + }, + { + "name": "ENSHIZHOU", + "value": 10 + } + ] + }, + { + "name": "F", + "items": [ + { + "name": "FUZHOU", + "value": 11 + }, + { + "name": "FOSHAN", + "value": 12 + }, + { + "name": "FANGCHENGGANG", + "value": 13 + } + ] + }, + { + "name": "G", + "items": [ + { + "name": "GUANGZHOU", + "value": 14 + }, + { + "name": "GUIYANG", + "value": 15 + } + ] + }, + { + "name": "H", + "items": [ + { + "name": "HANGZHOU", + "value": 16 + }, + { + "name": "HETIANDIQU", + "value": 17 + } + ] + }, + { + "name": "Z", + "items": [ + { + "name": "ZHENGZHOU", + "value": 18 + }, + { + "name": "ZHANGJIAKOU", + "value": 19 + }, + { + "name": "ZHANGJIAJIE", + "value": 20 + }, + { + "name": "ZHUHAI", + "value": 21 + }, + { + "name": "ZHONGSHAN", + "value": 22 + }, + { + "name": "ZIGONG", + "value": 23 + }, + { + "name": "ZIYANG", + "value": 24 + }, + { + "name": "ZHAOZHUANG", + "value": 25 + }, + { + "name": "ZHOUSHAN", + "value": 26 + }, + { + "name": "ZUNYI", + "value": 27 + }, + { + "name": "ZIBO", + "value": 28 + }, + { + "name": "ZHUZHOU", + "value": 29 + }, + { + "name": "ZHONGWEI", + "value": 30 + } + ] + } +] diff --git a/example/data/picker.js b/example/data/picker.js new file mode 100644 index 000000000..4987cf90d --- /dev/null +++ b/example/data/picker.js @@ -0,0 +1,125 @@ +const data1 = [ + { + text: '剧毒', + value: '剧毒' + }, { + text: '蚂蚁', + value: '蚂蚁' + }, + { + text: '幽鬼', + value: '幽鬼' + }, + { + text: '主宰', + value: '主宰' + }, + { + text: '卡尔', + value: '卡尔' + }, + { + text: '宙斯', + value: '宙斯' + }, + { + text: '巫医', + value: '巫医' + }, { + text: '巫妖', + value: '巫妖' + }, + { + text: '神谕者', + value: '神谕者' + }, + { + text: '撼地神牛', + value: '神谕者' + }, + { + text: '蓝胖子', + value: '蓝胖子' + }, + { + text: '水晶室女', + value: '水晶室女' + }, + { + text: '莉娜', + value: '莉娜' + }, + { + text: '斯拉克', + value: '斯拉克' + }, + { + text: '斯拉达', + value: '斯拉达' + } +] + +const data2 = [ + { + text: '输出', + value: '输出' + }, { + text: '控制', + value: '控制' + }, + { + text: '核心', + value: '核心' + }, + { + text: '爆发', + value: '爆发' + }, + { + text: '辅助', + value: '辅助' + }, + { + text: '打野', + value: '打野' + }, + { + text: '逃生', + value: '逃生' + }, { + text: '先手', + value: '先手' + } +] + +const data3 = [ + { + text: '梅肯', + value: '梅肯' + }, { + text: '秘法鞋', + value: '秘法鞋' + }, + { + text: '假腿', + value: '假腿' + }, + { + text: '飞鞋', + value: '飞鞋' + }, + { + text: '辉耀', + value: '辉耀' + }, + { + text: '金箍棒', + value: '金箍棒' + } +] + +export { + data1, + data2, + data3 +} diff --git a/example/index.html b/example/index.html new file mode 100644 index 000000000..151f92e39 --- /dev/null +++ b/example/index.html @@ -0,0 +1,12 @@ + + + + + cube-ui lib + + + +
+ + diff --git a/example/main.js b/example/main.js new file mode 100644 index 000000000..dd323393d --- /dev/null +++ b/example/main.js @@ -0,0 +1,96 @@ +// The Vue build version to load with the `import` command +// (runtime-only or standalone) has been set in webpack.base.conf with an alias. +import Vue from 'vue' +import VueRouter from 'vue-router' +import Cube from '../src/index' +import App from './App.vue' + +import Button from './pages/button.vue' +import Checkbox from './pages/checkbox.vue' +import CheckboxGroup from './pages/checkbox-group.vue' +import Loading from './pages/loading.vue' +import Tip from './pages/tip.vue' +import Popup from './pages/popup.vue' +import Toast from './pages/toast.vue' +import Picker from './pages/picker.vue' +import TimePicker from './pages/time-picker.vue' +import Dialog from './pages/dialog.vue' +import ActionSheet from './pages/action-sheet.vue' +import Scroll from './pages/scroll.vue' +import Slide from './pages/slide.vue' +import IndexList from './pages/index-list.vue' + +Vue.use(Cube) +Vue.use(VueRouter) + +const routes = [ + { + path: '/button', + component: Button + }, + { + path: '/checkbox', + component: Checkbox + }, + { + path: '/checkbox-group', + component: CheckboxGroup + }, + { + path: '/loading', + component: Loading + }, + { + path: '/tip', + component: Tip + }, + { + path: '/popup', + component: Popup + }, + { + path: '/toast', + component: Toast + }, + { + path: '/picker', + component: Picker + }, + { + path: '/time-picker', + component: TimePicker + }, + { + path: '/dialog', + component: Dialog + }, + { + path: '/action-sheet', + component: ActionSheet + }, + { + path: '/scroll', + component: Scroll + }, + { + path: '/slide', + component: Slide + }, + { + path: '/index-list', + component: IndexList + } +] + +const router = new VueRouter({ + routes +}) + +/* eslint-disable no-new */ +new Vue({ + router, + render(createElement) { + return createElement(App) + } +}).$mount('#app') + diff --git a/example/pages/action-sheet.vue b/example/pages/action-sheet.vue new file mode 100644 index 000000000..6cf419fa0 --- /dev/null +++ b/example/pages/action-sheet.vue @@ -0,0 +1,112 @@ + + + + + diff --git a/example/pages/button.vue b/example/pages/button.vue new file mode 100644 index 000000000..c4aac1722 --- /dev/null +++ b/example/pages/button.vue @@ -0,0 +1,62 @@ + + + diff --git a/example/pages/checkbox-group.vue b/example/pages/checkbox-group.vue new file mode 100644 index 000000000..f31b82ed4 --- /dev/null +++ b/example/pages/checkbox-group.vue @@ -0,0 +1,42 @@ + + + + + diff --git a/example/pages/checkbox.vue b/example/pages/checkbox.vue new file mode 100644 index 000000000..39552a0f1 --- /dev/null +++ b/example/pages/checkbox.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/example/pages/dialog.vue b/example/pages/dialog.vue new file mode 100644 index 000000000..1e5ee4eee --- /dev/null +++ b/example/pages/dialog.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/example/pages/index-list.vue b/example/pages/index-list.vue new file mode 100644 index 000000000..993da9f1b --- /dev/null +++ b/example/pages/index-list.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/example/pages/loading.vue b/example/pages/loading.vue new file mode 100644 index 000000000..550a5fba4 --- /dev/null +++ b/example/pages/loading.vue @@ -0,0 +1,19 @@ + + + diff --git a/example/pages/picker.vue b/example/pages/picker.vue new file mode 100644 index 000000000..2912caa63 --- /dev/null +++ b/example/pages/picker.vue @@ -0,0 +1,109 @@ + + + + + diff --git a/example/pages/popup.vue b/example/pages/popup.vue new file mode 100644 index 000000000..5a68352aa --- /dev/null +++ b/example/pages/popup.vue @@ -0,0 +1,76 @@ + + + + + diff --git a/example/pages/scroll.vue b/example/pages/scroll.vue new file mode 100644 index 000000000..2797b17d0 --- /dev/null +++ b/example/pages/scroll.vue @@ -0,0 +1,151 @@ + + + + + diff --git a/example/pages/slide.vue b/example/pages/slide.vue new file mode 100644 index 000000000..e73f95ecd --- /dev/null +++ b/example/pages/slide.vue @@ -0,0 +1,55 @@ + + + diff --git a/example/pages/time-picker.vue b/example/pages/time-picker.vue new file mode 100644 index 000000000..968f4b14c --- /dev/null +++ b/example/pages/time-picker.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/example/pages/tip.vue b/example/pages/tip.vue new file mode 100644 index 000000000..29a8357c6 --- /dev/null +++ b/example/pages/tip.vue @@ -0,0 +1,89 @@ + + + + + diff --git a/example/pages/toast.vue b/example/pages/toast.vue new file mode 100644 index 000000000..81bb2797a --- /dev/null +++ b/example/pages/toast.vue @@ -0,0 +1,60 @@ + + + diff --git a/package.json b/package.json new file mode 100644 index 000000000..78071bac6 --- /dev/null +++ b/package.json @@ -0,0 +1,131 @@ +{ + "name": "cube-ui", + "version": "0.0.1", + "description": "A fantastic mobile ui lib implement by Vue", + "main": "lib/index.js", + "module": "src/index.js", + "scripts": { + "build": "node build/build.js", + "dev": "node build/dev-server.js", + "doc-dev": "npm run dev & node build/document/dev-server.js", + "doc-build": "node build/document/build.js", + "demo-build": "node build/example/build.js", + "doc-demo-build": "npm run doc-build && npm run demo-build", + "release": "bash ./build/release/publish.sh", + "release-docs": "bash ./build/release/docs.sh", + "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs", + "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run", + "test": "npm run unit" + }, + "files": [ + "src", + "lib" + ], + "repository": { + "type": "git", + "url": "git@github.com:didi/cube-ui.git" + }, + "homepage": "https://didi.github.io/cube-ui/", + "bugs": { + "url": "https://github.com/didi/cube-ui/issues" + }, + "keywords": [ + "cube-ui", + "cube", + "vue", + "components" + ], + "license": "Apache", + "dependencies": { + "better-scroll": "^1.4.0" + }, + "devDependencies": { + "autoprefixer": "^7.1.1", + "babel-core": "^6.22.1", + "babel-eslint": "^7.1.1", + "babel-loader": "^6.2.10", + "babel-plugin-add-module-exports": "^0.2.1", + "babel-plugin-istanbul": "^4.1.1", + "babel-plugin-transform-es2015-modules-umd": "^6.12.0", + "babel-plugin-transform-runtime": "^6.22.0", + "babel-polyfill": "^6.2.0", + "babel-preset-env": "^1.3.2", + "babel-preset-stage-2": "^6.22.0", + "babel-register": "^6.22.0", + "chai": "^3.5.0", + "chalk": "^1.1.3", + "connect-history-api-fallback": "^1.3.0", + "copy-webpack-plugin": "^4.0.1", + "cross-env": "^5.0.1", + "css-loader": "^0.28.0", + "eslint": "^3.19.0", + "eslint-config-standard": "^6.2.1", + "eslint-friendly-formatter": "^2.0.7", + "eslint-loader": "^1.7.1", + "eslint-plugin-html": "^2.0.0", + "eslint-plugin-promise": "^3.4.0", + "eslint-plugin-standard": "^2.0.1", + "eventsource-polyfill": "^0.9.6", + "express": "^4.14.1", + "extract-text-webpack-plugin": "^3.0.0", + "file-loader": "^0.11.1", + "friendly-errors-webpack-plugin": "^1.1.3", + "highlight.js": "^9.12.0", + "html-webpack-plugin": "^2.28.0", + "http-proxy-middleware": "^0.17.3", + "inject-loader": "^3.0.0", + "js-cookie": "^2.1.4", + "karma": "^1.4.1", + "karma-coverage": "^1.1.1", + "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.2", + "karma-phantomjs-shim": "^1.4.0", + "karma-sinon-chai": "^1.3.1", + "karma-sourcemap-loader": "^0.3.7", + "karma-spec-reporter": "0.0.31", + "karma-webpack": "^2.0.2", + "lolex": "^1.5.2", + "marked": "^0.3.6", + "mocha": "^3.2.0", + "mockjs": "^1.0.1-beta3", + "opn": "^4.0.2", + "optimize-css-assets-webpack-plugin": "^1.3.0", + "ora": "^1.2.0", + "phantomjs-prebuilt": "^2.1.14", + "postcss-loader": "^2.0.5", + "rimraf": "^2.6.0", + "scp2": "^0.5.0", + "shelljs": "^0.7.4", + "sinon": "^2.1.0", + "sinon-chai": "^2.8.0", + "style-loader": "^0.13.1", + "stylus": "^0.54.5", + "stylus-loader": "^2.1.1", + "url-loader": "^0.5.8", + "vue": "^2.5.2", + "vue-loader": "^12.1.0", + "vue-markdown-loader": "^2.2.1", + "vue-router": "^2.7.0", + "vue-style-loader": "^3.0.1", + "vue-template-compiler": "2.5.2", + "webpack": "^3.1.0", + "webpack-bundle-analyzer": "^2.2.1", + "webpack-dev-middleware": "^1.10.0", + "webpack-hot-middleware": "^2.18.0", + "webpack-merge": "^4.1.0" + }, + "engines": { + "node": ">= 4.0.0", + "npm": ">= 3.0.0" + }, + "browserslist": [ + "> 1%", + "last 2 versions", + "not ie <= 20", + "not ie_mob <= 100", + "not ff <= 100", + "not and_ff <= 100", + "not Edge <= 100", + "Android >= 4.0" + ] +} diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 000000000..8d0140ebd --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,7 @@ +module.exports = { + plugins: [ + require('autoprefixer')({ + browsers: require('./package.json').browserslist + }) + ] +} diff --git a/src/common/helpers/create-api-component.js b/src/common/helpers/create-api-component.js new file mode 100644 index 000000000..63a7b76b5 --- /dev/null +++ b/src/common/helpers/create-api-component.js @@ -0,0 +1,37 @@ +import instantiateComponent from './instantiate-component' +import parseRenderData from './parse-render-data' + +export default function createAPIComponent(Vue, Component, events = [], single = false) { + let singleComponent + let singleInstance + const api = { + open(data, renderFn) { + if (singleComponent) { + singleInstance.updateRenderData(data) + singleInstance.$forceUpdate() + // singleComponent.show && singleComponent.show() + return singleComponent + } + const component = instantiateComponent(Vue, Component, data, renderFn) + const instance = component.$parent + const originRemove = component.remove + + component.remove = function () { + originRemove && originRemove.call(this) + instance.destroy() + singleComponent = null + singleInstance = null + } + if (single) { + singleComponent = component + singleInstance = instance + } + // component.show && component.show() + return component + }, + create(config, renderFn) { + return api.open(parseRenderData(config, events), renderFn) + } + } + return api +} diff --git a/src/common/helpers/create-api.js b/src/common/helpers/create-api.js new file mode 100644 index 000000000..22893ed53 --- /dev/null +++ b/src/common/helpers/create-api.js @@ -0,0 +1,13 @@ +import { camelize } from '../lang/string' +import createAPIComponent from './create-api-component' + +export default function createAPI (Vue, Component, events, single) { + const api = createAPIComponent.apply(this, arguments) + const name = Component.name + const pureName = name.replace(/^cube-/i, '') + const apiName = `$${camelize(pureName)}` + const createName = `$${camelize(`create-${pureName}`)}` + Vue.prototype[apiName] = api + Vue.prototype[createName] = api.create + return api +} diff --git a/src/common/helpers/dom.js b/src/common/helpers/dom.js new file mode 100644 index 000000000..e1971986c --- /dev/null +++ b/src/common/helpers/dom.js @@ -0,0 +1,37 @@ +export function hasClass(el, className) { + const reg = new RegExp('(^|\\s)' + className + '(\\s|$)') + return reg.test(el.className) +} + +export function addClass(el, className) { + if (hasClass(el, className)) { + return + } + + const newClass = el.className.split(' ') + newClass.push(className) + el.className = newClass.join(' ') +} + +export function removeClass(el, className) { + if (!hasClass(el, className)) { + return + } + + const reg = new RegExp('(^|\\s)' + className + '(\\s|$)', 'g') + el.className = el.className.replace(reg, ' ') +} + +export function getData(el, name) { + const prefix = 'data-' + return el.getAttribute(prefix + name) +} + +export function getRect(el) { + return { + top: el.offsetTop, + left: el.offsetLeft, + width: el.offsetWidth, + height: el.offsetHeight + } +} diff --git a/src/common/helpers/instantiate-component.js b/src/common/helpers/instantiate-component.js new file mode 100644 index 000000000..2a6c17d39 --- /dev/null +++ b/src/common/helpers/instantiate-component.js @@ -0,0 +1,25 @@ +export default function instantiateComponent(Vue, Component, data, renderFn) { + let renderData + const instance = new Vue({ + render(createElement) { + return createElement(Component, renderData, renderFn ? [renderFn(createElement)] : []) + }, + methods: { + init() { + document.body.appendChild(this.$el) + }, + destroy() { + this.$destroy() + document.body.removeChild(this.$el) + } + } + }) + instance.updateRenderData = function (data) { + renderData = data + } + instance.updateRenderData(data) + instance.$mount() + instance.init() + const component = instance.$children[0] + return component +} diff --git a/src/common/helpers/parse-render-data.js b/src/common/helpers/parse-render-data.js new file mode 100644 index 000000000..ed2ef3aaf --- /dev/null +++ b/src/common/helpers/parse-render-data.js @@ -0,0 +1,28 @@ +import { camelize } from '../lang/string' + +export default function parseRenderData(data = {}, events = {}) { + events = parseEvents(events) + const props = { ...data } + const on = {} + for (const name in events) { + if (events.hasOwnProperty(name)) { + const handlerName = events[name] + if (props[handlerName]) { + on[name] = props[handlerName] + delete props[handlerName] + } + } + } + return { + props, + on + } +} + +function parseEvents(events) { + const parsedEvents = {} + events.forEach((name) => { + parsedEvents[name] = camelize(`on-${name}`) + }) + return parsedEvents +} diff --git a/src/common/icon/cube-icon.styl b/src/common/icon/cube-icon.styl new file mode 100644 index 000000000..0ee727bd6 --- /dev/null +++ b/src/common/icon/cube-icon.styl @@ -0,0 +1,40 @@ +@font-face + font-family: "cube-icon" + src: + url("./cubeic.woff") format("woff"), + url("./cubeic.ttf") format("truetype") + +[class^="cubeic-"], [class*=" cubeic-"] + font-family: "cube-icon"!important + font-size: 100% + font-style: normal + -webkit-font-smoothing: antialiased + -webkit-text-stroke-width: 0.2px + -moz-osx-font-smoothing: grayscale + +.cubeic-important::before + content: "\e68b" +.cubeic-alert::before + content: "\e676" +.cubeic-ok::before + content: "\e68c" +.cubeic-back::before + content: "\e608" +.cubeic-arrow::before + content: "\e60b" +.cubeic-close::before + content: "\e60d" +.cubeic-warn::before + content: "\e614" +.cubeic-question::before + content: "\e616" +.cubeic-right::before + content: "\e617" +.cubeic-wrong::before + content: "\e618" +.cubeic-info::before + content: "\e619" +.cubeic-danger::before + content: "\e641" +.cubeic-round-border::before + content: "\e683" diff --git a/src/common/icon/cubeic.ttf b/src/common/icon/cubeic.ttf new file mode 100644 index 000000000..1414981b2 Binary files /dev/null and b/src/common/icon/cubeic.ttf differ diff --git a/src/common/icon/cubeic.woff b/src/common/icon/cubeic.woff new file mode 100644 index 000000000..74be40725 Binary files /dev/null and b/src/common/icon/cubeic.woff differ diff --git a/src/common/lang/date.js b/src/common/lang/date.js new file mode 100644 index 000000000..cb128824a --- /dev/null +++ b/src/common/lang/date.js @@ -0,0 +1,31 @@ +export const DAY_TIMESTAMP = 60 * 60 * 24 * 1000 +export const HOUR_TIMESTAMP = 60 * 60 * 1000 +export const MINUTE_TIMESTAMP = 60 * 1000 + +export function formatDate(date, fmt) { + const o = { + 'M+': date.getMonth() + 1, + 'd+': date.getDate(), + 'h+': date.getHours(), + 'm+': date.getMinutes(), + 's+': date.getSeconds(), + 'q+': Math.floor((date.getMonth() + 3) / 3), + 'S': date.getMilliseconds() + } + if (/(y+)/.test(fmt)) { + fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length)) + } + for (const k in o) { + if (new RegExp('(' + k + ')').test(fmt)) { + fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))) + } + } + return fmt +} + +export function getZeroDate(date) { + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + return new Date(year + '/' + month + '/' + day + ' 00:00:00') +} diff --git a/src/common/lang/string.js b/src/common/lang/string.js new file mode 100644 index 000000000..4259b3197 --- /dev/null +++ b/src/common/lang/string.js @@ -0,0 +1,7 @@ +const camelizeRE = /-(\w)/g +export function camelize (str) { + str = String(str) + return str.replace(camelizeRE, function (m, c) { + return c ? c.toUpperCase() : '' + }) +} diff --git a/src/common/mixins/api.js b/src/common/mixins/api.js new file mode 100644 index 000000000..e32de6a2f --- /dev/null +++ b/src/common/mixins/api.js @@ -0,0 +1,15 @@ +export default { + data() { + return { + isVisible: false + } + }, + methods: { + show() { + this.isVisible = true + }, + hide() { + this.isVisible = false + } + } +} diff --git a/src/common/stylus/base.styl b/src/common/stylus/base.styl new file mode 100644 index 000000000..a3692f614 --- /dev/null +++ b/src/common/stylus/base.styl @@ -0,0 +1,89 @@ +@import "./variable.styl" + +body, html + line-height: 1 + font-family: 'PingFang SC', 'STHeitiSC-Light', 'Helvetica-Light', arial, sans-serif, 'Droid Sans Fallback' + user-select: none + -webkit-tap-highlight-color: transparent + +.clear-fix + &::after + content: "" + display: table + clear: both + +.border-top-1px, .border-right-1px, .border-bottom-1px, .border-left-1px + position: relative + &::before, &::after + content: "" + display: block + position: absolute + transform-origin: 0 0 + +.border-top-1px + &::before + border-top: 1px solid $color-row-line + left: 0 + top: 0 + width: 100% + transform-origin: 0 top + +.border-right-1px + &::after + border-right: 1px solid $color-col-line + top: 0 + right: 0 + height: 100% + transform-origin: right 0 + +.border-bottom-1px + &::after + border-bottom: 1px solid $color-row-line + left: 0 + bottom: 0 + width: 100% + transform-origin: 0 bottom + +.border-left-1px + &::before + border-left: 1px solid $color-col-line + top: 0 + left: 0 + height: 100% + transform-origin: left 0 + +@media (min-resolution: 2dppx) + .border-top-1px + &::before + width: 200% + transform: scale(.5) translateZ(0) + .border-right-1px + &::after + height: 200% + transform: scale(.5) translateZ(0) + .border-bottom-1px + &::after + width: 200% + transform: scale(.5) translateZ(0) + .border-left-1px + &::before + height: 200% + transform: scale(.5) translateZ(0) + +@media (min-resolution: 3dppx) + .border-top-1px + &::before + width: 300% + transform: scale(.333) translateZ(0) + .border-right-1px + &::after + height: 300% + transform: scale(.333) translateZ(0) + .border-bottom-1px + &::after + width: 300% + transform: scale(.333) translateZ(0) + .border-left-1px + &::before + height: 300% + transform: scale(.333) translateZ(0) diff --git a/src/common/stylus/index.styl b/src/common/stylus/index.styl new file mode 100644 index 000000000..eb1851bec --- /dev/null +++ b/src/common/stylus/index.styl @@ -0,0 +1,5 @@ +@import "./variable.styl" +@import "./mixin.styl" +@import "./reset.styl" +@import "./base.styl" +@import "../icon/cube-icon.styl" diff --git a/src/common/stylus/mixin.styl b/src/common/stylus/mixin.styl new file mode 100644 index 000000000..e213caded --- /dev/null +++ b/src/common/stylus/mixin.styl @@ -0,0 +1,56 @@ +border-1px($color = #ccc, $radius = 2px, $style = solid) + position: relative + &::after + content: "" + pointer-events: none + display: block + position: absolute + left: 0 + top: 0 + transform-origin: 0 0 + border: 1px $style $color + border-radius: $radius + box-sizing border-box + width 100% + height 100% + @media (min-resolution: 2dppx) + width: 200% + height: 200% + border-radius: $radius * 2 + transform: scale(.5) translateZ(0) + @media (min-resolution: 3dppx) + width: 300% + height: 300% + border-radius: $radius * 3 + transform: scale(.333) translateZ(0) + +border-none() + &::before + display: none + &::after + display: none + +flex-fix() + flex: 1 + flex-basis: 0.000000001px + width: 1% + +touch-active(type = orange) + if (type == orange) + &:active + color: #fcc1a6 + background-color: rgba(250, 143, 84, .04) + else + &:active + color: #c6c6c6 + background-color: rgba(0, 0, 0, .04) + +hide-scrollbar() + &::-webkit-scrollbar + width: 0 + height: 0 + +bg-image($url, $ext = ".png") + background-image: url($url + "@2x" + $ext) + @media (min-resolution: 3dppx) + background-image: url($url + "@3x" + $ext) diff --git a/src/common/stylus/reset.styl b/src/common/stylus/reset.styl new file mode 100644 index 000000000..0ec33f2e1 --- /dev/null +++ b/src/common/stylus/reset.styl @@ -0,0 +1,56 @@ +/** + * Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/) + * http://cssreset.com + */ +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, +menu, nav, output, ruby, section, summary, +time, mark, audio, video, input + margin: 0 + padding: 0 + border: 0 + font-size: 100% + font-weight: normal + vertical-align: baseline + +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, menu, nav, section + display: block + +body + line-height: 1 + +blockquote, q + quotes: none + +blockquote:before, blockquote:after, +q:before, q:after + content: none + +table + border-collapse: collapse + border-spacing: 0 + +/* custom */ + +a + color: #7e8c8d + -webkit-backface-visibility: hidden + text-decoration: none + +li + list-style: none + +body + -webkit-text-size-adjust: none + -webkit-tap-highlight-color: rgba(0, 0, 0, 0) diff --git a/src/common/stylus/theme/default.styl b/src/common/stylus/theme/default.styl new file mode 100644 index 000000000..1c4f9a105 --- /dev/null +++ b/src/common/stylus/theme/default.styl @@ -0,0 +1,119 @@ +@import "../var/color.styl" + +// action-sheet +$action-sheet-color = $color-grey +$action-sheet-active-color = $color-orange +$action-sheet-bgc = $color-white +$action-sheet-active-bgc = $color-light-grey-opacity +$action-sheet-title-color = $color-dark-grey +/// picker style +$action-sheet-picker-cancel-color = $color-light-grey +$action-sheet-picker-cancel-active-color = $color-light-grey-s + +// bubble + +// button +$btn-color = $color-white +$btn-bgc = $color-regular-blue +$btn-bdc = $color-regular-blue +$btn-active-bgc = $color-blue +$btn-active-bdc = $color-blue +$btn-disabled-color = $color-white +$btn-disabled-bgc = $color-light-grey-s +$btn-disabled-bdc = $color-light-grey-s +/// primary +$btn-primary-color = $color-white +$btn-primary-bgc = $color-orange +$btn-primary-bdc = $color-orange +$btn-primary-active-bgc = $color-dark-orange +$btn-primary-active-bdc = $color-dark-orange +/// light +$btn-light-color = $color-grey +$btn-light-bgc = $color-light-grey-sss +$btn-light-bdc = $color-light-grey-sss +$btn-light-active-bgc = $color-active-grey +$btn-light-active-bdc = $color-active-grey +/// outline +$btn-outline-color = $color-grey +$btn-outline-bgc = none +$btn-outline-bdc = $color-grey +$btn-outline-active-bgc = $color-grey-opacity +$btn-outline-active-bdc = $color-grey +/// outline-primary +$btn-outline-primary-color = $color-orange +$btn-outline-primary-bgc = none +$btn-outline-primary-bdc = $color-orange +$btn-outline-primary-active-bgc = $color-orange-opacity +$btn-outline-primary-active-bdc = $color-dark-orange + +// checkbox +$checkbox-color = $color-grey +$checkbox-bgc = $color-white +$checkbox-icon-color = $color-light-grey-s +$checkbox-icon-bgc = $color-white +/// checked +$checkbox-checked-icon-color = $color-orange +$checkbox-checked-icon-bgc = $color-white +/// disabled +$checkbox-disabled-icon-color = $color-light-grey-ss +$checkbox-disabled-icon-bgc = $color-light-grey-ss + +// checkbox-group +$checkbox-group-horizontal-bdc = $color-light-grey-s + +// dialog +$dialog-color = $color-grey +$dialog-bgc = $color-white +$dialog-icon-color = $color-regular-blue +$dialog-icon-bgc = $color-background +$dialog-title-color = $color-dark-grey +$dialog-close-color = $color-light-grey +$dialog-btn-color = $color-light-grey +$dialog-btn-bgc = $color-white +$dialog-btn-active-bgc = $$color-light-grey-opacity +$dialog-btn-highlight-color = $color-orange +$dialog-btn-highlight-active-bgc = $color-light-orange-opacity +$dialog-btn-disabled-color = $color-light-grey +$dialog-btn-disabled-active-bgc = transparent +$dialog-btns-split-color = $color-row-line + +// index-list +$index-list-bgc = $color-white +$index-list-box-shadow = 0 3px 6px $color-light-grey-ss +$index-list-title-color = $color-dark-grey +$index-list-anchor-color = $color-light-grey +$index-list-anchor-bgc = #f7f7f7 +$index-list-item-color = $color-dark-grey +$index-list-item-active-bgc = $color-light-grey-opacity +$index-list-nav-color = $color-grey +$index-list-nav-active-color = $color-orange + +// loading + +// picker +$picker-bgc = $color-white +$picker-title-color = $color-dark-grey +$picker-confirm-btn-color = $color-orange +$picker-confirm-btn-active-color = $color-light-orange +$picker-cancel-btn-color = $color-light-grey +$picker-cancel-btn-active-color = $color-light-grey-s +$picker-item-color = $color-dark-grey + +// popup +$popup-mask-bgc = $color-mask-bg + +// scroll + +// slide +$slide-dot-bgc = $color-light-grey-s +$slide-dot-active-bgc = $color-orange + +// time-picker + +// tip +$tip-color = $color-white +$tip-bgc = $color-dark-grey-opacity + +// toast +$toast-color = $color-light-grey-s +$toast-bgc = rgba(37, 38, 45, 0.9) diff --git a/src/common/stylus/var/box-shadow.styl b/src/common/stylus/var/box-shadow.styl new file mode 100644 index 000000000..ddddc8d0c --- /dev/null +++ b/src/common/stylus/var/box-shadow.styl @@ -0,0 +1,3 @@ +// box-shadow + +$box-shadow-content = 0 1px 3px rgba(0, 0, 0, .1) diff --git a/src/common/stylus/var/color.styl b/src/common/stylus/var/color.styl new file mode 100644 index 000000000..4566a1fa6 --- /dev/null +++ b/src/common/stylus/var/color.styl @@ -0,0 +1,36 @@ +// color vars +//// basic +$color-orange = #fc9153 +$color-regular-blue = #4a4c5b +$color-background = #f3f4f5 +$color-white = #fff + +//// gray +$color-dark-grey = #333 +$color-grey = #666 +$color-light-grey = #999 +$color-light-grey-s = #ccc +$color-light-grey-ss = #eee +$color-light-grey-sss = #fcfcfc +$color-active-grey = #e8e8e8 + +$color-dark-grey-opacity = rgba(74, 76, 91, 0.8) +$color-grey-opacity = rgba(0, 0, 0, .08) +$color-light-grey-opacity = rgba(0, 0, 0, .04) + +//// orange +$color-dark-orange = #e8864c +$color-light-orange = #fdc2a5 +$color-orange-opacity = rgba(252, 145, 83, .08) +$color-light-orange-opacity = rgba(252, 145, 83, .04) + +//// blue +$color-blue = #444654 + +//// row line +$color-row-line = #ebebeb +//// column line +$color-col-line = #f5f5f5 + +/// mask +$color-mask-bg = rgba(37, 38, 45, .4) diff --git a/src/common/stylus/var/size.styl b/src/common/stylus/var/size.styl new file mode 100644 index 000000000..dd89f6e84 --- /dev/null +++ b/src/common/stylus/var/size.styl @@ -0,0 +1,9 @@ +// font-size vars +$fontsize-large-xxxx = 30px +$fontsize-large-xxx = 24px +$fontsize-large-xx = 20px +$fontsize-large-x = 18px +$fontsize-large = 16px +$fontsize-medium = 14px +$fontsize-small = 12px +$fontsize-small-s = 10px diff --git a/src/common/stylus/variable.styl b/src/common/stylus/variable.styl new file mode 100644 index 000000000..fd87bee74 --- /dev/null +++ b/src/common/stylus/variable.styl @@ -0,0 +1,4 @@ +@import "./var/color.styl" +@import "./var/size.styl" +@import "./var/box-shadow.styl" +@import "./theme/default.styl" diff --git a/src/components/action-sheet/action-sheet.vue b/src/components/action-sheet/action-sheet.vue new file mode 100644 index 000000000..455e6e963 --- /dev/null +++ b/src/components/action-sheet/action-sheet.vue @@ -0,0 +1,171 @@ + + + + + diff --git a/src/components/bubble/bubble.vue b/src/components/bubble/bubble.vue new file mode 100644 index 000000000..7436ea8e9 --- /dev/null +++ b/src/components/bubble/bubble.vue @@ -0,0 +1,139 @@ + + + diff --git a/src/components/button/button.vue b/src/components/button/button.vue new file mode 100644 index 000000000..f6501042c --- /dev/null +++ b/src/components/button/button.vue @@ -0,0 +1,148 @@ + + + + + diff --git a/src/components/checkbox-group/checkbox-group.vue b/src/components/checkbox-group/checkbox-group.vue new file mode 100644 index 000000000..e397fad04 --- /dev/null +++ b/src/components/checkbox-group/checkbox-group.vue @@ -0,0 +1,87 @@ + + + diff --git a/src/components/checkbox/checkbox.vue b/src/components/checkbox/checkbox.vue new file mode 100644 index 000000000..37efb78a1 --- /dev/null +++ b/src/components/checkbox/checkbox.vue @@ -0,0 +1,159 @@ + + + diff --git a/src/components/dialog/dialog.vue b/src/components/dialog/dialog.vue new file mode 100644 index 000000000..9467a87b9 --- /dev/null +++ b/src/components/dialog/dialog.vue @@ -0,0 +1,263 @@ + + + + + diff --git a/src/components/index-list/index-list.vue b/src/components/index-list/index-list.vue new file mode 100644 index 000000000..0034e15b5 --- /dev/null +++ b/src/components/index-list/index-list.vue @@ -0,0 +1,273 @@ + + + + + diff --git a/src/components/loading/loading.gif b/src/components/loading/loading.gif new file mode 100755 index 000000000..618dd2975 Binary files /dev/null and b/src/components/loading/loading.gif differ diff --git a/src/components/loading/loading.vue b/src/components/loading/loading.vue new file mode 100644 index 000000000..238afe432 --- /dev/null +++ b/src/components/loading/loading.vue @@ -0,0 +1,32 @@ + + + diff --git a/src/components/picker/picker.vue b/src/components/picker/picker.vue new file mode 100644 index 000000000..668a0d0ad --- /dev/null +++ b/src/components/picker/picker.vue @@ -0,0 +1,328 @@ + + + + + diff --git a/src/components/popup/popup.vue b/src/components/popup/popup.vue new file mode 100644 index 000000000..6a225131e --- /dev/null +++ b/src/components/popup/popup.vue @@ -0,0 +1,86 @@ + + + + + diff --git a/src/components/scroll/scroll.vue b/src/components/scroll/scroll.vue new file mode 100644 index 000000000..63dff501a --- /dev/null +++ b/src/components/scroll/scroll.vue @@ -0,0 +1,293 @@ + + + + + + diff --git a/src/components/slide/slide-item.vue b/src/components/slide/slide-item.vue new file mode 100644 index 000000000..8ee1a2bb4 --- /dev/null +++ b/src/components/slide/slide-item.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/src/components/slide/slide.vue b/src/components/slide/slide.vue new file mode 100644 index 000000000..5b137801c --- /dev/null +++ b/src/components/slide/slide.vue @@ -0,0 +1,200 @@ + + + + + diff --git a/src/components/time-picker/time-picker.vue b/src/components/time-picker/time-picker.vue new file mode 100644 index 000000000..6ad672596 --- /dev/null +++ b/src/components/time-picker/time-picker.vue @@ -0,0 +1,343 @@ + + + diff --git a/src/components/tip/tip.vue b/src/components/tip/tip.vue new file mode 100644 index 000000000..330a7929e --- /dev/null +++ b/src/components/tip/tip.vue @@ -0,0 +1,206 @@ + + + diff --git a/src/components/toast/toast.vue b/src/components/toast/toast.vue new file mode 100644 index 000000000..566e14e45 --- /dev/null +++ b/src/components/toast/toast.vue @@ -0,0 +1,123 @@ + + + diff --git a/src/index.js b/src/index.js new file mode 100644 index 000000000..c2c556666 --- /dev/null +++ b/src/index.js @@ -0,0 +1,53 @@ +import { + Style, + Button, + Scroll, + Popup, + TimePicker, + Dialog, + Tip, + Toast, + ActionSheet, + CheckboxGroup, + Slide, + IndexList, + BScroll, + createAPI +} from './module' + +function install(Vue) { + if (install.installed) { + return + } + const components = [ + Style, + Button, + TimePicker, + Dialog, + Tip, + Toast, + CheckboxGroup, + Slide, + IndexList, + ActionSheet, + Scroll, + Popup + ] + components.forEach((Component) => { + Component.install(Vue) + }) +} + +const cube = { + /* eslint-disable no-undef */ + version: __VERSION__, + install, + BScroll, + createAPI +} + +if (typeof window !== 'undefined' && window.Vue) { + window.Vue.use(install) +} + +export default cube diff --git a/src/module.js b/src/module.js new file mode 100644 index 000000000..507158380 --- /dev/null +++ b/src/module.js @@ -0,0 +1,43 @@ +import Style from './modules/style' + +import Button from './modules/button' +import CheckboxGroup from './modules/checkbox-group' +import Popup from './modules/popup' +import Dialog from './modules/dialog' +import Toast from './modules/toast' + +import Tip from './modules/tip' +import ActionSheet from './modules/action-sheet' +import Slide from './modules/slide' +import IndexList from './modules/index-list' +import TimePicker from './modules/time-picker' +import Scroll from './modules/scroll' + +import BScroll from './modules/better-scroll' +import createAPI from './modules/create-api' + +const Picker = TimePicker.Picker +const Checkbox = CheckboxGroup.Checkbox +const Loading = Toast.Loading +const SlideItem = Slide.Item + +export { + Style, + Button, + Scroll, + Popup, + Picker, + TimePicker, + Dialog, + Tip, + Toast, + ActionSheet, + Checkbox, + CheckboxGroup, + Slide, + SlideItem, + Loading, + IndexList, + BScroll, + createAPI +} diff --git a/src/modules/action-sheet/api.js b/src/modules/action-sheet/api.js new file mode 100644 index 000000000..5540d8593 --- /dev/null +++ b/src/modules/action-sheet/api.js @@ -0,0 +1,5 @@ +import createAPI from '../../common/helpers/create-api' + +export default function addActionSheet (Vue, ActionSheet) { + createAPI(Vue, ActionSheet, ['select', 'cancel']) +} diff --git a/src/modules/action-sheet/index.js b/src/modules/action-sheet/index.js new file mode 100644 index 000000000..82d98022e --- /dev/null +++ b/src/modules/action-sheet/index.js @@ -0,0 +1,9 @@ +import ActionSheet from '../../components/action-sheet/action-sheet.vue' +import addActionSheet from './api' + +ActionSheet.install = function (Vue) { + Vue.component(ActionSheet.name, ActionSheet) + addActionSheet(Vue, ActionSheet) +} + +export default ActionSheet diff --git a/src/modules/better-scroll/index.js b/src/modules/better-scroll/index.js new file mode 100644 index 000000000..59f3914c5 --- /dev/null +++ b/src/modules/better-scroll/index.js @@ -0,0 +1,3 @@ +import BScroll from 'better-scroll' + +export default BScroll diff --git a/src/modules/button/index.js b/src/modules/button/index.js new file mode 100644 index 000000000..31a082398 --- /dev/null +++ b/src/modules/button/index.js @@ -0,0 +1,7 @@ +import Button from '../../components/button/button.vue' + +Button.install = function (Vue) { + Vue.component(Button.name, Button) +} + +export default Button diff --git a/src/modules/checkbox-group/index.js b/src/modules/checkbox-group/index.js new file mode 100644 index 000000000..b0d9a4a81 --- /dev/null +++ b/src/modules/checkbox-group/index.js @@ -0,0 +1,11 @@ +import Checkbox from '../../components/checkbox/checkbox.vue' +import CheckboxGroup from '../../components/checkbox-group/checkbox-group.vue' + +CheckboxGroup.install = function (Vue) { + Vue.component(Checkbox.name, Checkbox) + Vue.component(CheckboxGroup.name, CheckboxGroup) +} + +CheckboxGroup.Checkbox = Checkbox + +export default CheckboxGroup diff --git a/src/modules/checkbox/index.js b/src/modules/checkbox/index.js new file mode 100644 index 000000000..43dbbfd2c --- /dev/null +++ b/src/modules/checkbox/index.js @@ -0,0 +1,7 @@ +import Checkbox from '../../components/checkbox/checkbox.vue' + +Checkbox.install = function (Vue) { + Vue.component(Checkbox.name, Checkbox) +} + +export default Checkbox diff --git a/src/modules/create-api/index.js b/src/modules/create-api/index.js new file mode 100644 index 000000000..66ae9878d --- /dev/null +++ b/src/modules/create-api/index.js @@ -0,0 +1,3 @@ +import createAPI from '../../common/helpers/create-api' + +export default createAPI diff --git a/src/modules/dialog/api.js b/src/modules/dialog/api.js new file mode 100644 index 000000000..793e727d8 --- /dev/null +++ b/src/modules/dialog/api.js @@ -0,0 +1,12 @@ +import createAPI from '../../common/helpers/create-api' + +export default function addDialog (Vue, Dialog) { + const dialog = createAPI(Vue, Dialog, ['confirm', 'cancel', 'close', 'btn-click', 'link-click']) + const types = ['alert', 'confirm'] + types.forEach((type) => { + dialog[type] = function (config, renderFn) { + config.type = type + return dialog.create(config, renderFn) + } + }) +} diff --git a/src/modules/dialog/index.js b/src/modules/dialog/index.js new file mode 100644 index 000000000..9bc761082 --- /dev/null +++ b/src/modules/dialog/index.js @@ -0,0 +1,9 @@ +import Dialog from '../../components/dialog/dialog.vue' +import addDialog from './api' + +Dialog.install = function (Vue) { + Vue.component(Dialog.name, Dialog) + addDialog(Vue, Dialog) +} + +export default Dialog diff --git a/src/modules/index-list/index.js b/src/modules/index-list/index.js new file mode 100644 index 000000000..3bed83de3 --- /dev/null +++ b/src/modules/index-list/index.js @@ -0,0 +1,7 @@ +import IndexList from '../../components/index-list/index-list.vue' + +IndexList.install = function (Vue) { + Vue.component(IndexList.name, IndexList) +} + +export default IndexList diff --git a/src/modules/loading/index.js b/src/modules/loading/index.js new file mode 100644 index 000000000..70a17b11d --- /dev/null +++ b/src/modules/loading/index.js @@ -0,0 +1,7 @@ +import Loading from '../../components/loading/loading.vue' + +Loading.install = function (Vue) { + Vue.component(Loading.name, Loading) +} + +export default Loading diff --git a/src/modules/picker/api.js b/src/modules/picker/api.js new file mode 100644 index 000000000..e3b32a113 --- /dev/null +++ b/src/modules/picker/api.js @@ -0,0 +1,5 @@ +import createAPI from '../../common/helpers/create-api' + +export default function addPicker (Vue, Picker) { + createAPI(Vue, Picker, ['select', 'value-change', 'cancel', 'change']) +} diff --git a/src/modules/picker/index.js b/src/modules/picker/index.js new file mode 100644 index 000000000..29434272f --- /dev/null +++ b/src/modules/picker/index.js @@ -0,0 +1,9 @@ +import Picker from '../../components/picker/picker.vue' +import addPicker from './api' + +Picker.install = function (Vue) { + Vue.component(Picker.name, Picker) + addPicker(Vue, Picker) +} + +export default Picker diff --git a/src/modules/popup/api.js b/src/modules/popup/api.js new file mode 100644 index 000000000..fd7e89719 --- /dev/null +++ b/src/modules/popup/api.js @@ -0,0 +1,5 @@ +import createAPI from '../../common/helpers/create-api' + +export default function addPopup(Vue, Popup) { + createAPI(Vue, Popup, ['mask-click']) +} diff --git a/src/modules/popup/index.js b/src/modules/popup/index.js new file mode 100644 index 000000000..d6a545a8a --- /dev/null +++ b/src/modules/popup/index.js @@ -0,0 +1,9 @@ +import Popup from '../../components/popup/popup.vue' +import addPopup from './api' + +Popup.install = function (Vue) { + Vue.component(Popup.name, Popup) + addPopup(Vue, Popup) +} + +export default Popup diff --git a/src/modules/scroll/index.js b/src/modules/scroll/index.js new file mode 100644 index 000000000..73c806da3 --- /dev/null +++ b/src/modules/scroll/index.js @@ -0,0 +1,7 @@ +import Scroll from '../../components/scroll/scroll.vue' + +Scroll.install = function (Vue) { + Vue.component(Scroll.name, Scroll) +} + +export default Scroll diff --git a/src/modules/slide/index.js b/src/modules/slide/index.js new file mode 100644 index 000000000..f151f7533 --- /dev/null +++ b/src/modules/slide/index.js @@ -0,0 +1,11 @@ +import Slide from '../../components/slide/slide.vue' +import SlideItem from '../../components/slide/slide-item.vue' + +Slide.install = function (Vue) { + Vue.component(Slide.name, Slide) + Vue.component(SlideItem.name, SlideItem) +} + +Slide.Item = SlideItem + +export default Slide diff --git a/src/modules/style/index.js b/src/modules/style/index.js new file mode 100644 index 000000000..405afdb14 --- /dev/null +++ b/src/modules/style/index.js @@ -0,0 +1,5 @@ +import '../../common/stylus/index.styl' + +export default { + install() {} +} diff --git a/src/modules/time-picker/api.js b/src/modules/time-picker/api.js new file mode 100644 index 000000000..c2c364184 --- /dev/null +++ b/src/modules/time-picker/api.js @@ -0,0 +1,5 @@ +import createAPI from '../../common/helpers/create-api' + +export default function addTimePicker (Vue, TimePicker) { + createAPI(Vue, TimePicker, ['select', 'cancel', 'change']) +} diff --git a/src/modules/time-picker/index.js b/src/modules/time-picker/index.js new file mode 100644 index 000000000..089fe4389 --- /dev/null +++ b/src/modules/time-picker/index.js @@ -0,0 +1,15 @@ +import Picker from '../../components/picker/picker.vue' +import TimePicker from '../../components/time-picker/time-picker.vue' +import addTimePicker from './api' +import addPicker from '../picker/api' + +TimePicker.install = function (Vue) { + Vue.component(Picker.name, Picker) + Vue.component(TimePicker.name, TimePicker) + addPicker(Vue, Picker) + addTimePicker(Vue, TimePicker) +} + +TimePicker.Picker = Picker + +export default TimePicker diff --git a/src/modules/tip/index.js b/src/modules/tip/index.js new file mode 100644 index 000000000..f501f5e0d --- /dev/null +++ b/src/modules/tip/index.js @@ -0,0 +1,7 @@ +import Tip from '../../components/tip/tip.vue' + +Tip.install = function (Vue) { + Vue.component(Tip.name, Tip) +} + +export default Tip diff --git a/src/modules/toast/api.js b/src/modules/toast/api.js new file mode 100644 index 000000000..b16556a98 --- /dev/null +++ b/src/modules/toast/api.js @@ -0,0 +1,12 @@ +import createAPI from '../../common/helpers/create-api' + +export default function addToast (Vue, Toast) { + const toast = createAPI(Vue, Toast, [], true) + const types = ['loading', 'correct', 'error', 'warn'] + types.forEach(type => { + toast[type] = function (config) { + config.type = type + return toast.create(config) + } + }) +} diff --git a/src/modules/toast/index.js b/src/modules/toast/index.js new file mode 100644 index 000000000..d47928557 --- /dev/null +++ b/src/modules/toast/index.js @@ -0,0 +1,13 @@ +import Loading from '../../components/loading/loading.vue' +import Toast from '../../components/toast/toast.vue' +import addToast from './api' + +Toast.install = function (Vue) { + Vue.component(Loading.name, Loading) + Vue.component(Toast.name, Toast) + addToast(Vue, Toast) +} + +Toast.Loading = Loading + +export default Toast diff --git a/test/unit/.eslintrc b/test/unit/.eslintrc new file mode 100644 index 000000000..959a4f4b5 --- /dev/null +++ b/test/unit/.eslintrc @@ -0,0 +1,9 @@ +{ + "env": { + "mocha": true + }, + "globals": { + "expect": true, + "sinon": true + } +} diff --git a/test/unit/fake/index-list.json b/test/unit/fake/index-list.json new file mode 100644 index 000000000..3287beb99 --- /dev/null +++ b/test/unit/fake/index-list.json @@ -0,0 +1,152 @@ +[ + { + "name": "★热门城市", + "cities": [ + { + "name": "北京市", + "tags": "BEIJING,北京市", + "cityid": 1 + }, + { + "name": "上海市", + "tags": "SHANGHAI,上海市", + "cityid": 2 + } + ] + }, + { + "name": "A", + "cities": [ + { + "name": "鞍山市", + "tags": "ANSHAN,鞍山市", + "cityid": 3 + }, + { + "name": "安庆市", + "tags": "ANQING,安庆市", + "cityid": 4 + } + ] + }, + { + "name": "B", + "cities": [ + { + "name": "北京市", + "tags": "BEIJING,北京市", + "cityid": 1 + }, + { + "name": "巴音郭楞州", + "tags": "BAYINGUOLENGZHOU,巴音郭楞州", + "cityid": 5 + }, + { + "name": "博尔塔拉州", + "tags": "BOERTALAZHOU,博尔塔拉州", + "cityid": 6 + } + ] + }, + { + "name": "C", + "cities": [ + { + "name": "成都市", + "tags": "CHENGDU,成都市", + "cityid": 7 + } + ] + }, + { + "name": "E", + "cities": [ + { + "name": "鄂尔多斯市", + "tags": "EERDUOSI,鄂尔多斯市", + "cityid": 8 + }, + { + "name": "鄂州市", + "tags": "EZHOU,鄂州市", + "cityid": 9 + }, + { + "name": "恩施州", + "tags": "ENSHIZHOU,恩施州", + "cityid": 10 + } + ] + }, + { + "name": "F", + "cities": [ + { + "name": "福州市", + "tags": "FUZHOU,福州市", + "cityid": 11 + }, + { + "name": "佛山市", + "tags": "FOSHAN,佛山市", + "cityid": 12 + }, + { + "name": "防城港市", + "tags": "FANGCHENGGANG,防城港市", + "cityid": 13 + } + ] + }, + { + "name": "G", + "cities": [ + { + "name": "广州市", + "tags": "GUANGZHOU,广州市", + "cityid": 14 + }, + { + "name": "贵阳市", + "tags": "GUIYANG,贵阳市", + "cityid": 15 + } + ] + }, + { + "name": "H", + "cities": [ + { + "name": "杭州市", + "tags": "HANGZHOU,杭州市", + "cityid": 16 + }, + { + "name": "和田地区", + "tags": "HETIANDIQU,和田地区", + "cityid": 17 + } + ] + }, + { + "name": "Z", + "cities": [ + { + "name": "郑州市", + "tags": "ZHENGZHOU,郑州市", + "cityid": 18 + }, + { + "name": "张家口市", + "tags": "ZHANGJIAKOU,张家口市", + "cityid": 19 + }, + { + "name": "中卫市", + "tags": "ZHONGWEI,中卫市", + "cityid": 20 + } + ] + } +] diff --git a/test/unit/index.js b/test/unit/index.js new file mode 100644 index 000000000..383059c6e --- /dev/null +++ b/test/unit/index.js @@ -0,0 +1,13 @@ +import Vue from 'vue' + +Vue.config.productionTip = false + +// require all test files (files that ends with .spec.js) +const testsContext = require.context('./specs', true, /\.spec$/) +testsContext.keys().forEach(testsContext) + +// require all src files except components/supper-shot & components/time-counter for coverage. +// you can also change this to match only the subset of files that +// you want coverage for. +const srcContext = require.context('../../src', true, /^\.\/(?!main(\.js)?$)/) +srcContext.keys().forEach(srcContext) diff --git a/test/unit/karma.conf.js b/test/unit/karma.conf.js new file mode 100644 index 000000000..d93b4ac54 --- /dev/null +++ b/test/unit/karma.conf.js @@ -0,0 +1,44 @@ +// This is a karma config file. For more details see +// http://karma-runner.github.io/0.13/config/configuration-file.html +// we are also using it with karma-webpack +// https://github.com/webpack/karma-webpack + +var webpackConfig = require('../../build/webpack.test.conf') + +module.exports = function (config) { + config.set({ + // to run in additional browsers: + // 1. install corresponding karma launcher + // http://karma-runner.github.io/0.13/config/browsers.html + // 2. add it to the `browsers` array below. + browsers: ['PhantomJS_mobile'], + customLaunchers:{ + PhantomJS_mobile: { + base: 'PhantomJS', + options: { + viewportSize: { + width: 375, + height: 667 + } + } + } + }, + frameworks: ['mocha', 'sinon-chai', 'phantomjs-shim'], + reporters: ['spec', 'coverage'], + files: ['./index.js'], + preprocessors: { + './index.js': ['webpack', 'sourcemap'] + }, + webpack: webpackConfig, + webpackMiddleware: { + noInfo: true + }, + coverageReporter: { + dir: './coverage', + reporters: [ + { type: 'lcov', subdir: '.' }, + { type: 'text-summary' } + ] + } + }) +} diff --git a/test/unit/specs/action-sheet.spec.js b/test/unit/specs/action-sheet.spec.js new file mode 100644 index 000000000..7693babfb --- /dev/null +++ b/test/unit/specs/action-sheet.spec.js @@ -0,0 +1,207 @@ +import Vue from 'vue2' +import ActionSheet from '@/modules/action-sheet' +import instantiateComponent from '@/common/helpers/instantiate-component' + +describe('ActionSheet', () => { + describe('ActionSheet.vue', () => { + let vm + afterEach(() => { + if (vm) { + vm.$parent.destroy() + vm = null + } + }) + it('use', () => { + Vue.use(ActionSheet) + expect(Vue.component(ActionSheet.name)) + .to.be.a('function') + }) + it('should render correct contents', () => { + vm = createActionSheet({ + data: [ + { + content: '左对齐', + align: 'left' + }, + { + content: '右对齐', + align: 'right' + } + ], + active: 1, + title: 'action sheet title' + }) + expect(vm.$el.querySelector('.cube-action-sheet-title').textContent) + .to.equal('action sheet title') + const items = vm.$el.querySelectorAll('.cube-action-sheet-item') + expect(items.length) + .to.equal(2) + expect(items[1].className) + .to.include('cube-action-sheet-item_active') + expect(items[0].textContent) + .to.equal('左对齐') + }) + it('should render correct contents - no data', () => { + vm = createActionSheet({ + title: 'action sheet title' + }) + const items = vm.$el.querySelectorAll('.cube-action-sheet-item') + expect(items.length) + .to.equal(0) + }) + it('should render correct contents - picker style', () => { + vm = createActionSheet({ + data: [ + { + content: '舒适型' + }, + { + content: '七座商务' + }, + { + content: '豪华型' + } + ], + pickerStyle: true, + active: 1, + title: 'action sheet title2' + }) + vm.show() + expect(vm.$el.className) + .to.include('cube-action-sheet_picker') + expect(vm.$el.querySelector('.cube-action-sheet-title').textContent) + .to.equal('action sheet title2') + const items = vm.$el.querySelectorAll('.cube-action-sheet-item') + expect(items.length) + .to.equal(3) + expect(items[1].className) + .to.include('cube-action-sheet-item_active') + expect(items[0].textContent) + .to.equal('舒适型') + expect(vm.$el.querySelector('.cube-action-sheet-space').offsetHeight) + .to.equal(0) + }) + + it('should trigger events', () => { + const selectHandler = sinon.spy() + const cancelHandler = sinon.spy() + const data = [ + { + content: '舒适型' + }, + { + content: '七座商务' + }, + { + content: '豪华型' + } + ] + vm = createActionSheet({ + data: data, + pickerStyle: true, + active: 1, + title: 'action sheet title2' + }, { + select: selectHandler, + cancel: cancelHandler + }) + vm.show() + const items = vm.$el.querySelectorAll('.cube-action-sheet-item') + + items[0].click() + expect(vm.isVisible) + .to.be.false + expect(selectHandler) + .to.be.calledWith(data[0]) + + vm.show() + vm.$el.querySelector('.cube-action-sheet-cancel').click() + expect(vm.isVisible) + .to.be.false + expect(cancelHandler) + .to.be.calledOnce + }) + + function createActionSheet (props = {}, events = {}) { + return instantiateComponent(Vue, ActionSheet, { + props: props, + on: events + }) + } + }) + + describe('ActionSheet API', () => { + it('$createActionSheet API', () => { + const selectHandler = sinon.spy() + const cancelHandler = sinon.spy() + const data = [ + { + content: '左对齐', + align: 'left' + }, + { + content: '右对齐', + align: 'right' + }, + { + content: '默认居中对齐' + }, + { + content: '自定义样式的内容', + class: 'orange' + }, + { + content: '嵌入了HTML的内容' + } + ] + let ins + const vm = new Vue({ + template: '
xx
', + methods: { + showAPI() { + ins = this.$createActionSheet({ + data: data, + active: 1, + title: 'action sheet api title', + onSelect: selectHandler, + onCancel: cancelHandler + }) + ins.show() + } + } + }) + vm.showAPI() + expect(ins.isVisible) + .to.be.true + expect(ins.$el.parentElement) + .to.equal(document.body) + + expect(ins.$el.querySelector('.cube-action-sheet-title').textContent) + .to.equal('action sheet api title') + const items = ins.$el.querySelectorAll('.cube-action-sheet-item') + expect(items.length) + .to.equal(5) + expect(items[1].className) + .to.include('cube-action-sheet-item_active') + expect(items[4].querySelector('span').textContent) + .to.equal('嵌入了HTML的内容') + + items[0].click() + expect(ins.isVisible) + .to.be.false + expect(selectHandler) + .to.be.calledWith(data[0]) + + ins.show() + ins.$el.querySelector('.cube-action-sheet-cancel').click() + expect(ins.isVisible) + .to.be.false + expect(cancelHandler) + .to.be.calledOnce + ins.remove() + expect(ins.$el.parentElement) + .to.be.null + vm.$destroy() + }) + }) +}) diff --git a/test/unit/specs/button.spec.js b/test/unit/specs/button.spec.js new file mode 100644 index 000000000..4f4598778 --- /dev/null +++ b/test/unit/specs/button.spec.js @@ -0,0 +1,87 @@ +import Vue from 'vue2' +import Button from '@/modules/button' +import instantiateComponent from '@/common/helpers/instantiate-component' + +describe('Button.vue', () => { + let vm + afterEach(() => { + if (vm) { + vm.$parent.destroy() + vm = null + } + }) + it('use', () => { + Vue.use(Button) + expect(Vue.component(Button.name)) + .to.be.a('function') + }) + it('should render correct contents', () => { + vm = instantiateComponent(Vue, Button, { + props: { + icon: 'mfic-back' + } + }, (createElement) => { + return createElement('span', 'btn content') + }) + expect(vm.$el.querySelector('i').className) + .to.equal('mfic-back') + expect(vm.$el.querySelector('span').textContent) + .to.equal('btn content') + }) + it('props', () => { + vm = instantiateComponent(Vue, Button, { + props: { + icon: 'mfic-back', + type: 'submit', + disabled: true, + inline: true, + outline: true, + primary: true, + light: true + } + }, (createElement) => { + return createElement('span', 'btn content') + }) + expect(vm.$el.type) + .to.equal('submit') + expect(vm.$el.className) + .to.equal('cube-btn cube-btn_disabled cube-btn-inline cube-btn-primary cube-btn-outline cube-btn-outline-primary cube-btn-light') + }) + it('events-called', () => { + const clickHandler = sinon.spy() + vm = instantiateComponent(Vue, Button, { + props: { + icon: 'mfic-back' + }, + on: { + click: clickHandler + } + }, (createElement) => { + return createElement('span', 'btn content') + }) + expect(clickHandler) + .to.have.callCount(0) + vm.$el.click() + expect(clickHandler) + .to.have.been.calledOnce + }) + it('events-no-called', () => { + const clickHandler = sinon.spy() + vm = instantiateComponent(Vue, Button, { + props: { + icon: 'mfic-back', + disabled: true + }, + on: { + click: clickHandler + } + }, (createElement) => { + return createElement('span', 'btn content') + }) + expect(clickHandler) + .to.have.callCount(0) + vm.$el.click() + expect(clickHandler) + .to.have.been.callCount(0) + }) +}) diff --git a/test/unit/specs/checkbox-group.spec.js b/test/unit/specs/checkbox-group.spec.js new file mode 100644 index 000000000..82d6c7d8f --- /dev/null +++ b/test/unit/specs/checkbox-group.spec.js @@ -0,0 +1,68 @@ +import Vue from 'vue2' +import CheckboxGroup from '@/modules/checkbox-group' +import createVue from '../utils/create-vue' + +describe('CheckboxGroup.vue', () => { + let vm + afterEach(() => { + if (vm) { + vm.$parent.destroy() + vm = null + } + }) + it('use', () => { + Vue.use(CheckboxGroup) + expect(Vue.component(CheckboxGroup.name)) + .to.be.a('function') + }) + it('should render correct contents (horizontal=false)', () => { + vm = createCheckboxGroup() + expect(vm.$el.className) + .to.include('cube-checkbox-group border-top-1px border-bottom-1px') + expect(vm.$el.querySelectorAll('.cube-checkbox').length) + .to.equal(4) + expect(vm.$el.querySelector('.cube-checkbox .cube-checkbox-wrap').className) + .to.include('cube-checkbox-wrap cube-checkbox_checked border-bottom-1px') + }) + it('should render correct contents (horizontal=true)', () => { + vm = createCheckboxGroup(true) + expect(vm.$el.className) + .to.include('cube-checkbox-group') + expect(vm.$el.querySelector('.cube-checkbox').className) + .to.include('cube-checkbox border-right-1px') + }) + it('should change v-model value', () => { + vm = createCheckboxGroup() + const p = vm.$parent + expect(p.checkList[0]) + .to.equal('1') + vm.$el.querySelector('.cube-checkbox-input').click() + expect(p.checkList[0]) + .to.equal('4') + vm.$el.querySelectorAll('.cube-checkbox-input')[1].click() + expect(p.checkList[1]) + .to.equal('2') + }) +}) + +function createCheckboxGroup (horizontal = false) { + const vm = createVue({ + template: ` + + +
+

自定义复选框A

+

通过slot方式插入自己的内容

+
+
+ 复选框B + 禁用状态(未选中) + 禁用状态(选中) +
+ `, + data: { + checkList: ['1', '4'] + } + }) + return vm +} diff --git a/test/unit/specs/checkbox.spec.js b/test/unit/specs/checkbox.spec.js new file mode 100644 index 000000000..4b6482c04 --- /dev/null +++ b/test/unit/specs/checkbox.spec.js @@ -0,0 +1,52 @@ +import Vue from 'vue2' +import Checkbox from '@/modules/checkbox' +import createVue from '../utils/create-vue' + +describe('Checkbox.vue', () => { + let vm + afterEach(() => { + if (vm) { + vm.$parent.destroy() + vm = null + } + }) + it('use', () => { + Vue.use(Checkbox) + expect(Vue.component(Checkbox.name)) + .to.be.a('function') + }) + it('should render correct contents', () => { + vm = createCheckbox() + const el = vm.$el + expect(el.className) + .to.equal('cube-checkbox my-checkbox') + expect(el.getAttribute('data-pos')) + .to.equal('left') + expect(el.querySelector('.cube-checkbox-wrap').className) + .to.equal('cube-checkbox-wrap cube-checkbox_checked') + expect(el.querySelector('.cube-checkbox-label').textContent.trim()) + .to.equal('checkbox') + }) + it('should toggle v-model value', () => { + vm = createCheckbox() + expect(vm.$parent.checked) + .to.be.true + vm.$el.querySelector('.cube-checkbox-input').click() + expect(vm.$parent.checked) + .to.be.false + }) +}) + +function createCheckbox () { + const vm = createVue({ + template: ` + + checkbox + + `, + data: { + checked: true + } + }) + return vm +} diff --git a/test/unit/specs/dialog.spec.js b/test/unit/specs/dialog.spec.js new file mode 100644 index 000000000..28e26b0fa --- /dev/null +++ b/test/unit/specs/dialog.spec.js @@ -0,0 +1,156 @@ +import Vue from 'vue2' +import Dialog from '@/modules/dialog' +import instantiateComponent from '@/common/helpers/instantiate-component' + +describe('Dialog', () => { + describe('Dialog.vue', () => { + let vm + afterEach(() => { + if (vm) { + vm.$parent.destroy() + vm = null + } + }) + it('use', () => { + Vue.use(Dialog) + expect(Vue.component(Dialog.name)) + .to.be.a('function') + }) + it('should render correct contents - icon', () => { + vm = createDialog({ + icon: 'icon-xx', + content: 'dialog' + }) + expect(vm.$el.querySelector('.cube-dialog-icon i').className) + .to.equal('icon-xx') + }) + it('should render correct contents - title', () => { + vm = createDialog({ + title: 'dialog title', + content: 'dialog' + }) + expect(vm.$el.querySelector('.cube-dialog-title-def').textContent) + .to.equal('dialog title') + }) + it('should render correct contents - alert', () => { + vm = createDialog({ + type: 'alert', + content: 'dialog' + }) + expect(vm.$el.querySelector('.cube-dialog-alert').parentElement.className) + .to.equal('cube-dialog-main') + expect(vm.$el.querySelector('.cube-dialog-btns').getElementsByTagName('a').length) + .to.equal(1) + }) + it('should render correct contents - confirm', () => { + vm = createDialog({ + type: 'confirm', + content: 'dialog' + }) + expect(vm.$el.querySelector('.cube-dialog-confirm').parentElement.className) + .to.equal('cube-dialog-main') + expect(vm.$el.querySelector('.cube-dialog-btns').getElementsByTagName('a').length) + .to.equal(2) + }) + + it('should trigger events', () => { + const confirmHandler = sinon.spy() + const cancelHandler = sinon.spy() + const closeHandler = sinon.spy() + vm = createDialog({ + type: 'confirm', + title: 'dialog title', + content: 'dialog' + }, { + confirm: confirmHandler, + cancel: cancelHandler, + close: closeHandler + }) + vm.show() + // confirm click + vm.$el.querySelector('.cube-dialog-btns a:last-child').click() + expect(vm.isVisible) + .to.be.false + expect(confirmHandler) + .to.be.calledOnce + vm.show() + vm.$el.querySelector('.cube-dialog-btns a').click() + expect(vm.isVisible) + .to.be.false + expect(cancelHandler) + .to.be.calledOnce + vm.show() + vm.$el.querySelector('.cube-dialog-close').click() + expect(vm.isVisible) + .to.be.false + expect(closeHandler) + .to.be.calledOnce + }) + + function createDialog (props = {}, events = {}) { + return instantiateComponent(Vue, Dialog, { + props: props, + on: events + }) + } + }) + + describe('Dialog API', () => { + it('$createDialog API', () => { + const confirmHandler = sinon.spy() + const cancelHandler = sinon.spy() + const closeHandler = sinon.spy() + let ins + const vm = new Vue({ + template: '
xx
', + methods: { + showAPI() { + ins = this.$dialog.confirm({ + showClose: true, + title: 'dialog api title', + content: 'dialog api content', + icon: 'cubeic-dialog-unwifi', + onConfirm: confirmHandler, + onCancel: cancelHandler, + onClose: closeHandler + }) + ins.show() + } + } + }) + vm.showAPI() + expect(ins.isVisible) + .to.be.true + expect(ins.$el.parentElement) + .to.equal(document.body) + expect(ins.$el.querySelector('.cube-dialog-title-def').textContent) + .to.equal('dialog api title') + expect(ins.$el.querySelector('.cube-dialog-content-def p').textContent) + .to.equal('dialog api content') + expect(ins.$el.querySelector('.cube-dialog-icon i').className) + .to.equal('cubeic-dialog-unwifi') + // confirm click + ins.$el.querySelector('.cube-dialog-btns a:last-child').click() + expect(ins.isVisible) + .to.be.false + expect(confirmHandler) + .to.be.calledOnce + ins.show() + ins.$el.querySelector('.cube-dialog-btns a').click() + expect(ins.isVisible) + .to.be.false + expect(cancelHandler) + .to.be.calledOnce + ins.show() + ins.$el.querySelector('.cube-dialog-close').click() + expect(ins.isVisible) + .to.be.false + expect(closeHandler) + .to.be.calledOnce + ins.remove() + expect(ins.$el.parentElement) + .to.be.null + vm.$destroy() + }) + }) +}) diff --git a/test/unit/specs/index-list.spec.js b/test/unit/specs/index-list.spec.js new file mode 100644 index 000000000..020f3ea58 --- /dev/null +++ b/test/unit/specs/index-list.spec.js @@ -0,0 +1,183 @@ +import Vue from 'vue2' +import IndexList from '@/modules/index-list' +import instantiateComponent from '@/common/helpers/instantiate-component' +import { dispatchSwipe } from '../utils/event' + +import cityData from '../fake/index-list.json' +// 处理数据 +let data = [] +cityData.forEach((cityGroup) => { + let group = {} + group.name = cityGroup.name + group.items = [] + cityGroup.cities.forEach((city) => { + let item = {} + item.name = city.name + item.value = city.cityid + group.items.push(item) + }) + data.push(group) +}) +const title = '当前城市:北京市' +describe('IndexList', () => { + describe('IndexList.vue', () => { + let vm + afterEach(() => { + if (vm) { + vm.$parent.destroy() + vm = null + } + }) + it('use', () => { + Vue.use(IndexList) + expect(Vue.component(IndexList.name)) + .to.be.a('function') + }) + it('should render correct contents', () => { + vm = createIndexList() + expect(vm.$el.querySelector('.cube-index-list-title').textContent.trim()) + .to.equal('当前城市:北京市') + const navItems = vm.$el.querySelectorAll('.cube-index-list-nav li') + expect(navItems.length) + .to.equal(9) + expect(navItems[2].textContent) + .to.equal('B') + const anchorItems = vm.$el.querySelectorAll('.cube-index-list-content .cube-index-list-anchor') + expect(anchorItems.length) + .to.equal(9) + expect(anchorItems[4].textContent) + .to.equal('E') + + const items = vm.$el.querySelectorAll('.cube-index-list-item') + expect(items.length) + .to.equal(21) + expect(items[items.length - 1].textContent.trim()) + .to.equal('中卫市') + }) + + it('should trigger events', () => { + const selectHandler = sinon.spy() + const titleClickHandler = sinon.spy() + + vm = createIndexList({ + select: selectHandler, + 'title-click': titleClickHandler + }) + const items = vm.$el.querySelectorAll('.cube-index-list-item') + items[2].click() + expect(selectHandler) + .to.be.calledWith(data[1].items[0]) + + vm.$el.querySelector('.cube-index-list-title').click() + expect(titleClickHandler) + .to.be.calledWith(title) + }) + + it('should fixed title', function () { + this.timeout(10000) + vm = createIndexList({}, []) + return new Promise((resolve) => { + setTimeout(() => { + vm.$parent.updateRenderData({ + props: { + title: title, + data: data + }, + on: {} + }) + vm.$parent.$forceUpdate() + vm.refresh() + }, 30) + setTimeout(() => { + const zEle = vm.$el.querySelector('.cube-index-list-nav li[data-index="2"]') + // nav li + dispatchSwipe(zEle, { + pageX: 342, + pageY: 327 + }, 0) + setTimeout(() => { + // item active class + dispatchSwipe(vm.$el.querySelector('.cube-index-list-item'), { + pageX: 342, + pageY: 327 + }, 0) + // scroll + const fixedEle = vm.$el.querySelector('.cube-index-list-fixed') + expect(fixedEle.textContent.trim()) + .to.equal('B') + const el = vm.$el.querySelector('.cube-index-list-content') + vm.$refs.indexList.scroll.on('scrollEnd', () => { + expect(fixedEle.textContent.trim()) + .to.equal('C') + resolve() + }) + dispatchSwipe(el, [ + { + pageX: 300, + pageY: 400 + }, + { + pageX: 300, + pageY: 380 + } + ], 100) + }, 20) + }, 150) + }) + }) + + it('should handle condition of unexpected param', function () { + this.timeout(10000) + vm = createIndexList() + return new Promise((resolve) => { + setTimeout(() => { + const bEl = vm.$el.querySelector('.cube-index-list-nav li[data-index="2"]') + dispatchSwipe(bEl, [ + { + pageX: 300, + pageY: 400 + }, + { + pageX: 300, + pageY: 50 + } + ], 100) + setTimeout(() => { + const fixedEl = vm.$el.querySelector('.cube-index-list-fixed') + expect(fixedEl.textContent.trim()) + .to.equal('★热门城市') + + dispatchSwipe(bEl, [ + { + pageX: 300, + pageY: 400 + }, + { + pageX: 300, + pageY: 1000 + } + ], 100) + setTimeout(() => { + expect(fixedEl.textContent.trim()) + .to.equal('Z') + resolve() + }, 150) + }, 150) + + vm.scrollY = 0 + setTimeout(() => { + vm.scrollY = -10000 + }, 0) + }, 30) + }) + }) + + function createIndexList (events = {}, _data = data) { + const props = {title: title, data: _data} + return instantiateComponent(Vue, IndexList, { + props: props, + on: events + }) + } + }) +}) diff --git a/test/unit/specs/loading.spec.js b/test/unit/specs/loading.spec.js new file mode 100644 index 000000000..efaa0bf82 --- /dev/null +++ b/test/unit/specs/loading.spec.js @@ -0,0 +1,25 @@ +import Vue from 'vue2' +import Loading from '@/modules/loading' +import instantiateComponent from '@/common/helpers/instantiate-component' + +describe('Loading.vue', () => { + let vm + afterEach(() => { + if (vm) { + vm.$parent.destroy() + vm = null + } + }) + it('use', () => { + Vue.use(Loading) + expect(Vue.component(Loading.name)) + .to.be.a('function') + }) + it('should render correct contents', () => { + vm = instantiateComponent(Vue, Loading, {}) + expect(vm.$el.className) + .to.equal('cube-loading') + expect(vm.$el.querySelector('img').src) + .to.not.be.empty + }) +}) diff --git a/test/unit/specs/picker.spec.js b/test/unit/specs/picker.spec.js new file mode 100644 index 000000000..f9cbf1108 --- /dev/null +++ b/test/unit/specs/picker.spec.js @@ -0,0 +1,165 @@ +import Vue from 'vue2' +import Picker from '@/modules/picker' +import instantiateComponent from '@/common/helpers/instantiate-component' + +const data1 = [ + { + text: '剧毒', + value: 1 + }, { + text: '蚂蚁', + value: 2 + }, + { + text: '幽鬼', + value: 3 + } +] + +const data2 = [ + { + text: '输出', + value: 'a' + }, { + text: '控制', + value: 'b' + }, + { + text: '核心', + value: 'c' + }, + { + text: '爆发', + value: 'd' + }, + { + text: '辅助', + value: 'e' + } +] +const props = { + title: '两列选择器', + data: [data1, data2], + cancelTxt: '关闭', + confirmTxt: '好的' +} + +describe('Picker', () => { + let vm + + afterEach(() => { + if (vm) { + vm.$parent.destroy() + vm = null + } + }) + + it('use', () => { + Vue.use(Picker) + expect(Vue.component(Picker.name)) + .to.be.a('function') + }) + + it('should render correct contents', function () { + vm = createPicker(props) + + const cancelBtn = vm.$el.querySelector('.cube-picker-choose [data-action="cancel"]') + expect(cancelBtn.textContent.trim()) + .to.equal('关闭') + + const confirmBtn = vm.$el.querySelector('.cube-picker-choose [data-action="confirm"]') + expect(confirmBtn.textContent.trim()) + .to.equal('好的') + + const wheels = vm.$el.querySelectorAll('.cube-picker-wheel-wrapper > div') + expect(wheels.length) + .to.equal(2) + + const firstWheelItems = wheels[0].querySelectorAll('li') + expect(firstWheelItems.length) + .to.equal(3) + expect(firstWheelItems[1].textContent.trim()) + .to.equal('蚂蚁') + + const secondWheelItems = wheels[1].querySelectorAll('li') + expect(secondWheelItems.length) + .to.equal(5) + expect(secondWheelItems[4].textContent.trim()) + .to.equal('辅助') + }) + + it('should trigger events', function () { + this.timeout(10000) + + const selectHandle = sinon.spy() + const valueChangeHandle = sinon.spy() + const cancelHandle = sinon.spy() + const changeHandle = sinon.spy() + const events = { + select: selectHandle, + 'value-change': valueChangeHandle, + cancel: cancelHandle, + change: changeHandle + } + + vm = createPicker() + return new Promise((resolve) => { + setTimeout(() => { + vm.$parent.updateRenderData({ + props: props, + on: events + }) + vm.$parent.$forceUpdate() + vm.refresh() + }, 30) + setTimeout(() => { + vm.show() + setTimeout(() => { + const cancelBtn = vm.$el.querySelector('.cube-picker-choose [data-action="cancel"]') + cancelBtn.click() + expect(cancelHandle) + .to.be.callCount(1) + + vm.show() + setTimeout(() => { + const confirmBtn = vm.$el.querySelector('.cube-picker-choose [data-action="confirm"]') + confirmBtn.click() + expect(selectHandle) + .to.be.callCount(1) + resolve() + }, 100) + }, 100) + }, 150) + }) + }) + + it('should refill correct', function (done) { + this.timeout(10000) + vm = createPicker({ + title: '变化选择器', + data: [data1], + selectedIndex: [1], + cancelTxt: '关闭', + confirmTxt: '好的' + }) + vm.show() + setTimeout(() => { + const ret = vm.refill([data2]) + expect(ret[0]).to.equal(0) + setTimeout(() => { + vm.scrollTo(0, 2) + vm.confirm() + expect(vm.pickerSelectedIndex[0]).to.equal(2) + expect(vm.pickerSelectedVal[0]).to.equal(data2[2].value) + done() + }) + }, 150) + }) + + function createPicker(props = {}, events = {}) { + return instantiateComponent(Vue, Picker, { + props: props, + on: events + }) + } +}) diff --git a/test/unit/specs/poup.spec.js b/test/unit/specs/poup.spec.js new file mode 100644 index 000000000..94aa47db9 --- /dev/null +++ b/test/unit/specs/poup.spec.js @@ -0,0 +1,93 @@ +import Vue from 'vue2' +import Popup from '@/modules/popup' +import instantiateComponent from '@/common/helpers/instantiate-component' + +describe('Popup', () => { + describe('Popup.vue', () => { + let vm + afterEach(() => { + if (vm) { + vm.$parent.destroy() + vm = null + } + }) + it('use', () => { + Vue.use(Popup) + expect(Vue.component(Popup.name)) + .to.be.a('function') + }) + it('should render correct contents - no type', () => { + vm = instantiateComponent(Vue, Popup, { + props: { + type: '' + } + }) + expect(vm.$el.className) + .to.equal('cube-popup') + }) + it('should render correct contents', () => { + vm = instantiateComponent(Vue, Popup, { + props: { + type: 'xx', + content: 'popup content' + } + }) + vm.show() + expect(vm.$el.className) + .to.equal('cube-popup cube-xx') + expect(vm.$el.querySelector('.cube-popup-container').className) + .to.equal('cube-popup-container cube-popup-center') + expect(vm.$el.querySelector('.cube-popup-content').innerHTML) + .to.equal('popup content') + }) + it('events', () => { + const clickHandler = sinon.spy() + vm = instantiateComponent(Vue, Popup, { + props: { + type: 'xx', + content: 'popup content' + }, + on: { + 'mask-click': clickHandler + } + }) + vm.$el.querySelector('.cube-popup-mask').click() + expect(clickHandler) + .to.have.been.calledOnce + }) + }) + + describe('Popup API', () => { + it('$createPopup API', () => { + const clickHandler = sinon.spy() + let ins + const vm = new Vue({ + template: '
xx
', + methods: { + showAPI() { + ins = this.$createPopup({ + type: 'xx', + content: 'popup api content', + onMaskClick: clickHandler + }) + ins.show() + } + } + }) + vm.showAPI() + expect(ins.isVisible) + .to.be.true + expect(ins.$el.parentElement) + .to.equal(document.body) + expect(ins.$el.querySelector('.cube-popup-content').innerHTML) + .to.equal('popup api content') + ins.$el.querySelector('.cube-popup-mask').click() + expect(clickHandler) + .to.have.been.calledOnce + ins.remove() + expect(ins.$el.parentElement) + .to.be.null + vm.$destroy() + }) + }) +}) diff --git a/test/unit/specs/scroll.spec.js b/test/unit/specs/scroll.spec.js new file mode 100644 index 000000000..c3ffc0b6d --- /dev/null +++ b/test/unit/specs/scroll.spec.js @@ -0,0 +1,171 @@ +import Vue from 'vue2' +import Scroll from '@/modules/scroll' +import instantiateComponent from '@/common/helpers/instantiate-component' +import { dispatchSwipe } from '../utils/event' +const props = { + data: [ + '我是第 1 行', + '我是第 2 行', + '我是第 3 行', + '我是第 4 行' + ], + pullDownRefresh: { + threshold: 10, + stop: 40, + txt: '刷新成功' + }, + pullUpLoad: { + threshold: 0, + txt: { + more: '加载更多订单', + noMore: '没有更多订单了' + } + }, + listenScroll: true, + listenBeforeScroll: true +} + +describe('Scroll', () => { + let vm + + afterEach(() => { + if (vm) { + vm.$parent.destroy() + vm = null + } + }) + + it('use', () => { + Vue.use(Scroll) + expect(Vue.component(Scroll.name)) + .to.be.a('function') + }) + + it('should render correct contents', () => { + vm = createScroll(props) + const listItems = vm.$el.querySelectorAll('.cube-scroll-content li') + expect(listItems.length) + .to.equal(4) + expect(listItems[1].textContent) + .to.equal('我是第 2 行') + expect(listItems[3].textContent) + .to.equal('我是第 4 行') + }) + + it('should trigger pullingDown', function () { + this.timeout(10000) + + const pullingDownHandle = sinon.spy() + vm = createScroll(props, { + 'pulling-down': pullingDownHandle + }) + vm.$refs.wrapper.style.height = '200px' + + return new Promise((resolve) => { + setTimeout(() => { + const listFirstItem = vm.$el.querySelector('.cube-scroll-content li:first-child') + dispatchSwipe(listFirstItem, [ + { + pageX: 10, + pageY: 10 + }, + { + pageX: 10, + pageY: 160 + } + ], 100) + setTimeout(() => { + expect(pullingDownHandle) + .to.be.callCount(1) + const newData = props.data.concat(['我是插入的一行']) + vm.$parent.updateRenderData({ + props: { + ...props, + data: newData + } + }) + vm.$parent.$forceUpdate() + setTimeout(() => { + setTimeout(() => { + setTimeout(() => { + expect(vm.beforePullDown).to.be.true + expect(vm.isPullingDown).to.be.false + resolve() + }, 750) + }, 650) + }, 50) + }, 400) + }, 150) + }) + }) + + it('should trigger pullingUp', function () { + this.timeout(10000) + + const pullingUpHandle = sinon.spy() + vm = createScroll(props, { + 'pulling-up': pullingUpHandle + }) + vm.$refs.wrapper.style.height = '200px' + + return new Promise((resolve) => { + setTimeout(() => { + const listItem = vm.$el.querySelector('.cube-scroll-content li:nth-child(3)') + dispatchSwipe(listItem, [ + { + pageX: 10, + pageY: 160 + }, + { + pageX: 10, + pageY: 10 + } + ], 100) + + setTimeout(() => { + expect(pullingUpHandle) + .to.be.callCount(1) + const newData = props.data.concat(['我是新附加1', '我是新附加2']) + vm.$parent.updateRenderData({ + props: { + ...props, + data: newData + } + }) + vm.$parent.$forceUpdate() + setTimeout(() => { + expect(vm.isPullUpLoad).to.be.false + expect(vm.pullUpDirty).to.be.true + resolve() + }, 50) + }, 400) + }, 150) + }) + }) + + it('should trigger click', function () { + this.timeout(10000) + + const clickHandle = sinon.spy() + vm = createScroll(props, { + click: clickHandle + }) + vm.$refs.wrapper.style.height = '200px' + + return new Promise((resolve) => { + setTimeout(() => { + const listItem = vm.$el.querySelector('.cube-scroll-content li') + listItem.click() + expect(clickHandle).to.be.calledWith(props.data[0]) + resolve() + }, 50) + }) + }) + + function createScroll (props = {}, events = {}) { + return instantiateComponent(Vue, Scroll, { + props: props, + on: events + }) + } +}) diff --git a/test/unit/specs/slide.spec.js b/test/unit/specs/slide.spec.js new file mode 100644 index 000000000..879f7e4b3 --- /dev/null +++ b/test/unit/specs/slide.spec.js @@ -0,0 +1,84 @@ +import Vue from 'vue2' +import Slide from '@/modules/slide' +import createVue from '../utils/create-vue' +import { dispatchSwipe } from '../utils/event' + +describe('Slide.vue', () => { + let vm + afterEach(() => { + if (vm) { + vm.$parent.destroy() + vm = null + } + }) + it('use', () => { + Vue.use(Slide) + expect(Vue.component(Slide.name)) + .to.be.a('function') + }) + it('should render correct contents', function (done) { + this.timeout(10000) + const items = ['1', '2', '3'] + vm = createSlide(items) + setTimeout(() => { + const itemEles = vm.$el.querySelectorAll('.cube-slide-item') + // for loop + expect(itemEles.length).to.equal(3 + 2) + expect(itemEles[2].textContent).to.equal(items[1]) + let dotEles = vm.$el.querySelectorAll('.cube-slide-dots span') + expect(dotEles.length).to.equal(3) + expect(dotEles[0].className).to.equal('active') + setTimeout(() => { + // dotEles = vm.$el.querySelectorAll('.cube-slide-dots span') + expect(dotEles[0].className).not.to.equal('active') + expect(dotEles[1].className).to.equal('active') + done() + }, 1500) + }, 200) + }) + it('should trigger change event', function (done) { + this.timeout(10000) + const items = ['1', '2', '3'] + const changeHandler = sinon.spy() + vm = createSlide(items, changeHandler) + setTimeout(() => { + // auto change + expect(changeHandler).to.be.calledWith(1) + // dispatch touch + dispatchSwipe(vm.$el, [ + { + pageX: 160, + pageY: 20 + }, + { + pageX: 10, + pageY: 20 + } + ], 100) + setTimeout(() => { + expect(changeHandler).to.be.calledTwice + done() + }, 600) + }, 2000) + }) +}) + +function createSlide (items, changeHandler) { + const vm = createVue({ + template: ` + + {{item}} + + `, + data: { + items, + interval: 1000 + }, + methods: { + change(newIndex) { + changeHandler && changeHandler.call(vm, newIndex) + } + } + }) + return vm +} diff --git a/test/unit/specs/time-picker.spec.js b/test/unit/specs/time-picker.spec.js new file mode 100644 index 000000000..8649923a6 --- /dev/null +++ b/test/unit/specs/time-picker.spec.js @@ -0,0 +1,131 @@ +import Vue from 'vue2' +import TimePicker from '@/modules/time-picker' +import instantiateComponent from '@/common/helpers/instantiate-component' + +describe('TimePicker', () => { + let vm + afterEach(() => { + if (vm) { + vm.$parent.destroy() + vm = null + } + }) + + it('use', () => { + Vue.use(TimePicker) + expect(Vue.component(TimePicker.name)) + .to.be.a('function') + }) + + it('should render correct contents', function (done) { + vm = createPicker() + + const cancelBtn = vm.$el.querySelector('.cube-picker-choose [data-action="cancel"]') + expect(cancelBtn.textContent.trim()) + .to.equal('取消') + + const confirmBtn = vm.$el.querySelector('.cube-picker-choose [data-action="confirm"]') + expect(confirmBtn.textContent.trim()) + .to.equal('确定') + vm.show() + setTimeout(() => { + const wheels = vm.$el.querySelectorAll('.cube-picker-wheel-wrapper > div') + expect(wheels.length) + .to.equal(3) + const firstWheelItems = wheels[0].querySelectorAll('li') + expect(firstWheelItems.length) + .to.equal(3) + expect(firstWheelItems[0].textContent.trim()) + .to.equal('今日') + const secondWheelItem = wheels[1].querySelector('li') + expect(secondWheelItem.textContent.trim()) + .to.equal('现在') + vm.hide() + const nextDate = +new Date(Date.now() + 24 * 60 * 60 * 1000) + vm.setTime(nextDate) + vm.show() + setTimeout(() => { + const wheel = vm.$el.querySelector('.cube-picker-wheel-wrapper > div > ul') + const transform = wheel.style.webkitTransform || wheel.style.transform + expect(transform.match(/translate\(0px,\s*(-?\d+)px\)/)[1]) + .to.equal('-36') + done() + }, 100) + }, 100) + }) + + it('should render correct contents - no showNow', function (done) { + vm = createPicker({ + showNow: false, + title: '自定义标题', + day: { + len: 4, + filter: ['今天'], + format: 'M月d日' + } + }) + + const cancelBtn = vm.$el.querySelector('.cube-picker-choose [data-action="cancel"]') + expect(cancelBtn.textContent.trim()) + .to.equal('取消') + + const confirmBtn = vm.$el.querySelector('.cube-picker-choose [data-action="confirm"]') + expect(confirmBtn.textContent.trim()) + .to.equal('确定') + vm.show() + setTimeout(() => { + const wheels = vm.$el.querySelectorAll('.cube-picker-wheel-wrapper > div') + expect(wheels.length) + .to.equal(3) + const firstWheelItems = wheels[0].querySelectorAll('li') + expect(firstWheelItems.length) + .to.equal(4) + expect(firstWheelItems[0].textContent.trim()) + .to.equal('今天') + done() + }, 100) + }) + + it('should trigger events', function () { + this.timeout(10000) + + const selectHandle = sinon.spy() + const cancelHandle = sinon.spy() + const changeHandle = sinon.spy() + const events = { + select: selectHandle, + cancel: cancelHandle, + change: changeHandle + } + + vm = createPicker({}, events) + return new Promise((resolve) => { + vm.show() + setTimeout(() => { + const cancelBtn = vm.$el.querySelector('.cube-picker-choose [data-action="cancel"]') + cancelBtn.click() + expect(cancelHandle) + .to.be.callCount(1) + + vm.show() + setTimeout(() => { + const confirmBtn = vm.$el.querySelector('.cube-picker-choose [data-action="confirm"]') + confirmBtn.click() + const now = +new Date() + expect(selectHandle) + .to.be.callCount(1) + expect(selectHandle.args[0][0]) + .to.be.closeTo(now, 2) + resolve() + }, 100) + }, 100) + }) + }) +}) + +function createPicker(props = {}, events = {}) { + return instantiateComponent(Vue, TimePicker, { + props: props, + on: events + }) +} diff --git a/test/unit/specs/tip.spec.js b/test/unit/specs/tip.spec.js new file mode 100644 index 000000000..b04e2fcda --- /dev/null +++ b/test/unit/specs/tip.spec.js @@ -0,0 +1,71 @@ +import Vue from 'vue2' +import Tip from '@/modules/tip' +import instantiateComponent from '@/common/helpers/instantiate-component' + +describe('Tip.vue', () => { + let vm + afterEach(() => { + if (vm) { + vm.$parent.destroy() + vm = null + } + }) + it('use', () => { + Vue.use(Tip) + expect(Vue.component(Tip.name)) + .to.be.a('function') + }) + it('should render correct contents', () => { + vm = createTip() + expect(vm.$el.getAttribute('data-dir')) + .to.equal('left') + expect(vm.$el.querySelector('i').className) + .to.equal('cube-tip-angle') + expect(vm.$el.querySelector('.cube-tip-content').textContent) + .to.equal('tip content') + return Promise.resolve() + }) + it('should render correct contents with offset[X]', () => { + vm = createTip({ + direction: 'left', + offsetTop: 20, + offsetLeft: '30%' + }) + return new Promise(resolve => { + setTimeout(resolve) + }).then((resolve) => { + const angleStyle = vm.$el.querySelector('.cube-tip-angle').style + expect(angleStyle.top) + .to.equal('20px') + expect(angleStyle.bottom) + .to.equal('auto') + expect(angleStyle.left) + .to.equal('30%') + expect(angleStyle.right) + .to.equal('auto') + }) + }) + it('should be hidden after clicked content', () => { + vm = createTip() + vm.$el.querySelector('.cube-tip-content').click() + expect(vm.isVisible) + .to.be.false + return Promise.resolve() + }) + it('should be hidden after clicked close button', () => { + vm = createTip() + vm.$el.querySelector('.cube-tip-close').click() + expect(vm.isVisible) + .to.be.false + return Promise.resolve() + }) +}) + +function createTip (props = {direction: 'left'}) { + const vm = instantiateComponent(Vue, Tip, { + props: props + }, (createElement) => { + return createElement('span', 'tip content') + }) + return vm +} diff --git a/test/unit/specs/toast.spec.js b/test/unit/specs/toast.spec.js new file mode 100644 index 000000000..567e04d6b --- /dev/null +++ b/test/unit/specs/toast.spec.js @@ -0,0 +1,116 @@ +import Vue from 'vue2' +import Toast from '@/modules/toast' +import instantiateComponent from '@/common/helpers/instantiate-component' + +describe('Toast', () => { + describe('Toast.vue', () => { + let vm + afterEach(() => { + if (vm) { + vm.$parent.destroy() + vm = null + } + }) + it('use', () => { + Vue.use(Toast) + expect(Vue.component(Toast.name)) + .to.be.a('function') + }) + it('should render correct contents - no type', () => { + vm = instantiateComponent(Vue, Toast, { + props: { + time: 300, + txt: 'toast content' + } + }) + vm.show() + expect(vm.$el.className) + .to.equal('cube-popup cube-toast') + expect(vm.$el.querySelector('.cube-loading')) + .not.to.be.null + return new Promise((resolve) => { + setTimeout(resolve, 330) + }) + }) + it('should render correct contents - time 0', () => { + vm = instantiateComponent(Vue, Toast, { + props: { + type: 'error', + time: 0, + txt: 'toast content' + } + }) + vm.show() + return new Promise((resolve) => { + setTimeout(() => { + expect(vm.isVisible) + .to.be.true + vm.hide() + expect(vm.isVisible) + .to.be.false + resolve() + }, 0) + }) + }) + it('should render correct contents - with type', () => { + vm = instantiateComponent(Vue, Toast, { + props: { + type: 'error', + time: 300, + txt: 'toast content' + } + }) + vm.show() + expect(vm.$el.className) + .to.equal('cube-popup cube-toast') + expect(vm.$el.querySelector('.cube-toast-icon').className) + .to.include('cubeic-wrong') + expect(vm.$el.querySelector('.cube-toast-tip').textContent) + .to.equal('toast content') + return new Promise((resolve) => { + setTimeout(() => { + expect(vm.isVisible) + .to.be.false + resolve() + }, 330) + }) + }) + }) + + describe('Toast API', () => { + it('$createToast API', (done) => { + let ins + const vm = new Vue({ + template: '
xx
', + methods: { + showAPI() { + ins = this.$createToast({ + type: 'error', + txt: 'error txt', + time: 200 + }) + ins = this.$toast.warn({ + txt: 'toast api content', + time: 100 + }) + ins.show() + } + } + }) + vm.showAPI() + expect(ins.isVisible) + .to.be.true + expect(ins.$el.parentElement) + .to.equal(document.body) + setTimeout(() => { + expect(ins.$el.querySelector('.cube-toast-tip').textContent) + .to.equal('toast api content') + ins.remove() + expect(ins.$el.parentElement) + .to.be.null + vm.$destroy() + done() + }) + }) + }) +}) diff --git a/test/unit/utils/create-vue.js b/test/unit/utils/create-vue.js new file mode 100644 index 000000000..d74ce21cb --- /dev/null +++ b/test/unit/utils/create-vue.js @@ -0,0 +1,34 @@ +import Vue from 'vue2' + +export default function createVue(options = {}, Component, data, renderFn) { + const methods = options.methods || {} + delete options.methods + options = { + ...options, + methods: { + ...methods, + init() { + document.body.appendChild(this.$el) + }, + destroy() { + this.$destroy() + document.body.removeChild(this.$el) + } + } + } + let renderData + if (Component) { + options.render = function (createElement) { + return createElement(Component, renderData, renderFn ? [renderFn(createElement)] : []) + } + } + const instance = new Vue(options) + instance.updateRenderData = function (data) { + renderData = data + } + instance.updateRenderData(data) + instance.$mount() + instance.init() + const component = instance.$children[0] + return component +} diff --git a/test/unit/utils/event.js b/test/unit/utils/event.js new file mode 100644 index 000000000..a12bef057 --- /dev/null +++ b/test/unit/utils/event.js @@ -0,0 +1,46 @@ +export function createEvent (type, name) { + const e = document.createEvent(type || 'Event') + e.initEvent(name, true, true) + return e +} + +export function dispatchClick (target, props) { + const event = createEvent('', 'click') + Object.assign(event, props) + target.dispatchEvent(event) +} + +export function dispatchTouch (target, name = 'touchstart', touches) { + const event = createEvent('', name) + event.touches = event.targetTouches = event.changedTouches = Array.isArray(touches) ? touches : [touches] + target.dispatchEvent(event) +} + +export function dispatchTouchStart (target, touches) { + dispatchTouch(target, 'touchstart', touches) +} + +export function dispatchTouchMove (target, touches) { + dispatchTouch(target, 'touchmove', touches) +} + +export function dispatchTouchEnd (target, touches) { + dispatchTouch(target, 'touchend', touches) +} + +export function dispatchSwipe (target, touches, duration, cb) { + if (!Array.isArray(touches)) { + touches = [touches] + } + dispatchTouchStart(target, touches[0]) + const moveAndEnd = () => { + dispatchTouchMove(target, touches[1] || touches[0]) + dispatchTouchEnd(target, touches[2] || touches[1] || touches[0]) + cb && cb() + } + if (duration) { + setTimeout(moveAndEnd, duration) + } else { + moveAndEnd() + } +}