• This repository has been archived on 12/Dec/2017
  • Stars
    star
    158
  • Rank 237,131 (Top 5 %)
  • Language
    JavaScript
  • License
    Do What The F*ck ...
  • Created almost 9 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[DEPRECATED]

⚠️ DEPRECATED ⚠️

You Need https://github.com/ElementUI/region-picker

This code is very 💩, I do not want to maintain it. 👋

vue-region-picker

Build Status npm

A Vue.js Component for picking provinces, cities and districts of China.

Supports both Vue 1.x and 2.0!

Demo

Requirements

Area data

Install

$ npm install vue-region-picker china-area-data --save

Usage

html

<div id="#app">
  <!-- Vue1.x -->
  <region-picker
    :province.sync="province"
    :city.sync="city"
    :district.sync="district">
  </region-picker>
  <!-- Vue2 -->
  <region-picker
    :province="province"
    :city="city"
    :district="district"
    @onchange="change">
  </region-picker>
</div>

javascript

import Vue from 'vue'
import RegionPicker from 'vue-region-picker'
import REGION_DATA from 'china-area-data'

Vue.use(RegionPicker, {
  region: REGION_DATA
})

// Vue1.x
new Vue({
  el: '#app',

  data () {
    return {
      province: '广东', // you can set initial value or not.
      city: 440100, // by code or name.
      district: ''
    }
  }
})

Or

import Vue from 'vue'
import { RegionPicker } from 'vue-region-picker'
import REGION_DATA from 'china-area-data'

RegionPicker.region = REGION_DATA

new Vue({
  el: '#app',

  data () {
    return {
      province: '广东', // you can set initial value or not.
      city: 440100, // by code or name.
      district: ''
    }
  },

  components: { RegionPicker }
})

Options

name description Type default Value
region region data Object -

Props

name description Type default Value
province Bind province. You can set the initial value or not. Set the initial value by (number)code or (string)name. Number, String
city Bind city. You can set the initial value or not. Set the initial value by (number)code or (string)name. Number, String
district Bind district. You can set the initial value or not. Set the initial value by (number)code or (string)name. Number, String
placeholder Placeholder Object { province: '请选择', city: '请选择', district: '请选择'}
auto If empty option will automatically hide. Boolean false
required Required if the option is not empty. Boolean false
completed Allow the return value is complete, it contains an array of code(number) and name(string). e.g. { "district": [ 440105, "海珠区" ], "city": [ 440100, "广州市" ], "province": [ 440000, "广东省" ] } Boolean false
disabled disabled Boolean false
two-select If true, display only province and city Boolean false
onchange selected callback Function

Slots

name description
province province label
city city label
district district label
<region-picker
  :province.sync="address.province"
  :city.sync="address.city"
  :district.sync="address.district">
  <span slot="province">省份</span>
  <span slot="city">城市</span>
  <span slot="district">地区</span>
</region-picker>

Development

$ npm run dev

Testing and Building

$ npm test
$ npm run dist

License

WTFPL

More Repositories

1

vue-trend

🌈 Simple, elegant spark lines for Vue.js
JavaScript
1,191
star
2

vuep

🎡 A component for rendering Vue components with live editor and preview.
JavaScript
886
star
3

vue-markdown-loader

📇 Convert Markdown file to Vue2.0 component.
JavaScript
702
star
4

laue

🖖📈 Modern charts for Vue 2.0
JavaScript
263
star
5

vuerify

🚩Validation plugin for Vue.js
JavaScript
191
star
6

vuep.run

🏃 An online playground for Vue2.0
Vue
140
star
7

npmarket

🛒 More efficient search for node packages.
Vue
93
star
8

jsdoc-vue

[➡️ https://github.com/Kocal/jsdoc-vuejs] A jsdoc plugin that parses *.vue files.
Vue
69
star
9

vue-tricks

Vue
47
star
10

donate

❤️ Donate to @QingWei-Li
24
star
11

pue-loader

🐍 A more pythonic javascript for Vue component file. (Pug + CoffeeScript + Stylus)
JavaScript
20
star
12

vue-delay

🐌 Delay rendering component for Vue.js
JavaScript
17
star
13

typer

✍️ A simplified publishing tool
TypeScript
12
star
14

vueo

🍟 Easy to get value from vue instance via object paths.
JavaScript
10
star
15

hostext

🔡 Text hosting service
JavaScript
9
star
16

vuetch

👻 [WIP]A Vue 2.0 component that fetches data from a http request.
JavaScript
8
star
17

theme-color

Material theme color generator.
JavaScript
7
star
18

2webpack2

🕳️ Turn configuration of webpack 1 to 2
JavaScript
5
star
19

buble-jest

Jest plugin to use buble and babel(handle ES Modules) for transformation
JavaScript
5
star
20

highlightext

💡 Highlight text service
JavaScript
4
star
21

noop-webpack-plugin

🤷‍♀️ Webpack plugin that does nothing.
JavaScript
4
star
22

nft-swag

TypeScript
3
star
23

pue-syntax-highlight

Sublime Text syntax highlighting for single-file Vue components
3
star
24

htpl

A JavaScript templating engine uses Vue syntax.
TypeScript
3
star
25

vuea

🍔 Easy to drop or replace specified key in an array.
JavaScript
2
star
26

AutoBackupFolder

定时打包备份指定文件夹的程序
C#
2
star
27

MagicCubeReduction-CFOP

用cfop还原魔方, 第一个c#开发的程序,留个念想
C#
2
star
28

Aha

[DEPRECATED] 魔兽世界拍卖行辅助工具(客户端)
JavaScript
2
star
29

ablog

A homework orz
TypeScript
2
star
30

qingwei-li.github.io

HTML
1
star
31

sort

一些sort算法练习
JavaScript
1
star
32

parsedate

Converts a value to a Date
JavaScript
1
star
33

Polish

[DEPRECATED]
JavaScript
1
star
34

global-bin-path

DEPRECATED
JavaScript
1
star
35

site

1
star