vue-city-pinyin

vue城市选择组件(按城市首字母排序)


Keywords
vue-city-pinyin, vue-city-picker, vue-citypicker, vue-city-select, city-pinyin, city-select, citypicker
License
MIT
Install
npm install vue-city-pinyin@1.0.1

Documentation

vue-city-pinyin

Project setup

npm install vue-city-pinyin china-city-data 

Demo

color

# main.js
import Vue from 'vue';
import CityPinyin from 'vue-city-pinyin';
Vue.use(CityPinyin);
# App.vue
<CityPinyin :value="startCity" @on-change="onChange($event,0)" msg="出发城市"/>
<CityPinyin :value="endCity" @on-change="onChange($event,1)" msg="到达城市"/>
data() {
    return {
        startCity: {
          id: '',
          name: '',
        },
        endCity: {
          id: '',
          name: '',
        }
    }
},
methods: {
onChange(item, idx) {
    console.log(idx, item);
    if (!idx) {
      this.startCity = item;
    } else {
      this.endCity = item;
    }
  }
}
npm config set registry https://registry.npm.taobao.org
npm config set registry https://registry.npmjs.org