精华内容
下载资源
问答
  • vue实现城市选择,带拼音选择搜索,可以多次反复使用,数据直接请求本地的资源json数据直接请求本地的资源json
  • 1、实现头部搜索城市功能(v-if判断input不为空时,searchaction搜索城市结果列表块元素为true,indexof查找数据中的关键字) 2、遍历数组找出hot为true的热门城市 3、遍历数据,charAt(0)获取城市名称拼音的首拼...

    还是照旧加前提:页面极丑!请忽略,咱们看功能就行,懒得写样式了

    在这里插入图片描述
    在这里插入图片描述

    在这里插入图片描述

    前提:安装vue-cli vuex axios

    目标:
    1、实现头部搜索城市功能(v-if判断input不为空时,searchaction搜索城市结果列表块元素为true,indexof查找数据中的关键字)
    2、遍历数组找出hot为true的热门城市
    3、遍历数据,charAt(0)获取城市名称拼音的首拼字母,转换为大写,去重赋值,A-Z排序。2个用途,1是定义子集,按首拼该字母首拼的城市,2是显示在页面右侧,点击页面滚动到该字母子集的位置
    4、点击城市,该城市的id 、name等数据用vuex保存到全局中去供其他组件获取到值

    上代码

    html部分

    <div class="city">
        <header>
          <input type="text" v-model="searchcity" class="input-clear" placeholder="城市/拼音">
           <div class="over" v-if="searchaction">
            <ul>
              <li class="cityte" v-for="(item,index) in searcharr" :key="index" @click="choosecity(item.name,item.id)">{{item.name}}</li>
            </ul>
          </div>
        </header>
        <div class="mui-content">
          <div class="hot-city">
            <p>当前城市:{{this.$store.state.locatecityname}}</p>
            <p style="padding:1rem 0 0 0;">热门城市</p>
            <div class="hot-list">
              <div class="item-box fl" @click="choosecity(item.name,item.id)" v-for="(item,index) in hotcity" :key="index">{{item.name}}</div>
            </div>
          </div>
          <div class="city-main">
            <div class="city-list">
              <ul>
              	<li v-for="(item,index) in citymain" :key="index" class="cityli" :id="item.top">
              		<p class="cityle">{{item.top}}</p>
              		<ul>
                    <li v-for="(itemx,index) in item.citylist" :key="index" @click="choosecity(itemx.name,itemx.id)" class="cityte">{{itemx.name}}</li>
              		</ul>
              	</li>
              </ul>
            </div>
            <div class="city-letter">
            	<ul>
            		<li v-for="(item,index) in letter" :key="index" @click="lettercity($event)">{{item}}</li>
            	</ul>
            </div>
            <div class="showletter" v-if='showx'>{{showletter}}</div>
          </div>
        </div>
      </div>
    

    js部分

    import axios from 'axios'
    	export default {
          name:'city',
    	  data() {
    			return {
            datalist:[],
            letter:[],  //城市首拼列表
            hotcity:[],  //热门城市列表
            citymain:[],  //首拼+该首拼下城市列表
            showx:false,
            showletter:'',
            searchcity:[],  //输入框输入的文字
            searcharr:[],   //输入查找的城市匹配结果数组
            searchaction:false   //搜索城市结果列表块元素
    			}
    		},
    		
        mounted () {
          axios.get('../../static/city.json').then(response => {
            const citydata = response.data.cities;
            this.datalist = response.data.cities;
            let cityhead = []; //首拼字母集合
            let newcityhead = [];
    
            for(let i = 0;i < citydata.length;i++){
              let letteritem = citydata[i].pinyin.charAt(0).toUpperCase();  //获取城市拼音的首字母
              cityhead.push(letteritem);
    
              let ishot = citydata[i];
              if(citydata[i].isHot){
                this.hotcity.push(ishot);
              }
            }
            console.log(this.hotcity)
               
            cityhead = cityhead.sort(function compareFunction(item1,item2) {   //字母按中文顺序排序
              return item1.localeCompare(item2);
            });
            console.log(cityhead);  //字母数组,按中文顺序排,但未去重
    
            let headarr = [];
            for(let i = 0; i <cityhead.length;i++){   //去重
              if(!headarr.includes(cityhead[i])){
                headarr.push(cityhead[i]);
              }
            } 
            console.log(headarr);
            this.letter = headarr;  //完成去重并赋值
    
            for(let i = 0;i < headarr.length;i++){
              let cityitem = new Object();  //自定义对象,城市列表下子集(包括首字母、该字母首拼的城市集合)
              cityitem.top = headarr[i];   //首字母
              cityitem.citylist = [];   //该字母首拼的城市集合
                 
              for(let j = 0;j < citydata.length;j++){
                if(headarr[i].toLowerCase() === citydata[j].pinyin.charAt(0)){
                  let citya = new Object();
                  citya.name = citydata[j].name;
                  citya.id = citydata[j].cityId;
                  cityitem.citylist.push(citya);
                }
              }
              this.citymain.push(cityitem);   
            }
              
          }).catch(error => {
              console.log(error)
              this.errored = true
            }).finally(() => this.loading = false)
          },
        methods:{
          choosecity(name,id) {
            let cityid = id;
            let cityname = name;
            this.$store.commit("updatecityid",cityid)
            this.$store.commit("updatecityname",cityname)
            this.searchaction = false;
          },
          lettercity:function($event){
            let citym = document.getElementsByClassName("city-main")[0];
            let text = $event.currentTarget.innerText;
            let item = document.getElementById(text);
            this.showx = true;
            this.showletter = text;
            let that = this;
            setTimeout(function(){
              that.showx = false;
            },2000);
            citym.scrollTo(0,item.offsetTop - 350);
          }
        },
        watch:{
          searchcity:function(){
            let searchcities = [];
            if(this.searchcity != ""){
              this.searchaction = true;
              for(let i = 0;i < this.datalist.length;i++){
                let str = this.datalist[i].name;
                if(str.indexOf(this.searchcity) != -1){
                   let searchcityitem = new Object();
                   searchcityitem.id = this.datalist[i].cityId;
                   searchcityitem.name = this.datalist[i].name;
                   searchcities.push(searchcityitem);
                }  
              }
            }
            this.searcharr = searchcities;
            if(this.searchcity.length == 0){
              this.searchaction = false;  
            }else{
              this.searchaction = true;
            }
          }
        }
    	
    	}
    

    使用vuex别忘了把它注入到main.js里,我就经常忘/(ㄒoㄒ)/~~
    在这里插入图片描述

    Vuex 主要有四部分:

    state:包含了store中存储的各个状态。
    getter: 类似于 Vue 中的计算属性,根据其他 getter 或 state 计算返回值。
    mutation: 一组方法,是改变store中状态的执行者,只能是同步操作。
    action: 一组方法,其中可以包含异步操作。

    刚开始写在man.js里,但后续开发,用的越多越不方便,后来另外创了store目录存放
    在这里插入图片描述

    actions.js

    const actions = {
      ASYNC_SET_NAME({ state, commit, rootState }, payload) {
        setTimeout(() => {
          state.bName = 'asyncName'
        }, 4000)
      }
    }
    

    getter.js

    const getter = {
      doneTodos:(state,getter) => {
        return state.todos.filter(todo => todo.done)
      }
    }
    
    export default getter
    
    

    index.js

    import Vue from 'vue'
    import Vuex from 'vuex'
    import actions from './actions'
    import getter from './getter'
    import mutations from './mutations'
    import state from './state'
    
    
    Vue.use(Vuex)
    
    
    export default new Vuex.Store({
      state,
      getter,
      mutations,
      actions,
    })
    
    

    mutations.js

    const mutations = {
      updatecityname(state,arg){
        state.locatecityname = arg
      },
      updatecityid(state,arg){
        state.locatecityid = arg
      },
      savetoken(state,arg){
        state.token = arg;
         sessionStorage.setItem('Author',arg);
      },
    }
    
    export default mutations
    

    state.js

    const state = {
      locatecityname:'',
      locatecityid:'',
    }
    
    export default state
    

    最后,差点忘了,mock的城市数据city.json,当时我随便搜搜就找到了,懒得搜的,直接去我git里面拿吧
    https://github.com/czzxff/city

    展开全文
  • 主要介绍了vue实现城市列表选择功能,本文通过实例代码给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
  • Vue实现选择城市功能

    2020-08-30 09:52:42
    主要介绍了Vue实现选择城市功能,非常不错,具有参考借鉴价值,需要的朋友可以参考下
  • Vue实实现现选选择择城城市市功功能能 这篇文章主要介绍了Vue实现选择城市功能,非常不错具有参考借鉴价值需要的朋友可以参考下 查看完整的 码请到 我的github地址 /qianyinghuanmie/vue2.0-demos 一一结果果展展示示...
  • vue实现城市列表选择

    2018-07-16 11:08:00
    城市选择 <div class="iconfont back-icon"> export default { } @import '~styles/varibles.styl' ; @import '~styles/mixins.styl' ; .header overflow: hidden height $...

    成果展示

    最后的成果就是下面所展示的内容,因为gif图没有做,只能截图所展示,接下来,会带着大家一步一步的完成下面功能,脚手架搭建和node安装在本次案例不会讲解,如果了解,可以在我的博客园找到有详细介绍

    准备工作:

     引入axios插件,调用better-scroll第三方插件,本地json文件,可以参考目录中的city.json,有条件的也可以自己去扒

    功能分析

    1.获取json数据展示城市列表 。

    2.侧边字母定位滚动到相应的位置。

    3.实现搜索城市

    接下来我们开始对组件进行划分:本次案例中,总共划分为五个组件,下面就是组件的划分图

    创建city组件,通过父组件获取数据,传递给子组件

    <template>
        <div class="city">
            <CityHeader></CityHeader>   //头部
            <Search :list="cities"></Search>  //搜索
            <List :hot="hotCity" :letter="letter" :list="cities"></List> //城市列表
            <Alphabet @chang="handleLetterChang" :list="cities"></Alphabet>  //A-Z
        </div>
    </template>
    
    <script>
    import axios from 'axios'
    import CityHeader from './components/Header'
    import Search from './components/Search'
    import List from './components/List'
    import Alphabet from './components/Alphabet'
    export default {
        data () {
            return {
                cities:{}, // 城市列表
                hotCity:[], //热门城市
                letter: ''  // A-Z
            }
        },
        components: {
            CityHeader,
            Search,
            List,
            Alphabet
        },
        methods:{
            getCityInfo () {
                axios.get('/api/city.json').then(this.getCityInfoSucc)
            },
            getCityInfoSucc(res){
                 res = res.data
                if (res.ret && res.data) {
                    const data = res.data
                    this.hotCity = data.hotCities
                    this.cities = data.cities
                }
                console.log(this.cities)
            },
            handleLetterChang(letter) { //接受子组件传过来的
    //            console.log(letter)
                this.letter = letter
            }
        },
        mounted () {
            this.getCityInfo ()
        }
    }
    </script>
    
    <style scoped lang="stylus">
    
    </style>
    City组件

    把得到的数据分次传递个对应的子组件,这样有利于网站优化,不用频繁的请数据

    <template>
        <div class="city">
            <CityHeader></CityHeader>
            <Search :list="cities"></Search>
            <List :hot="hotCity" :letter="letter" :list="cities"></List>
            <Alphabet @chang="handleLetterChang" :list="cities"></Alphabet>
        </div>
    </template>
    export default {
        data () {
            return {
                cities:{}, // 城市列表
                hotCity:[], //热门城市
                letter: ''  // A-Z
            }
        },
        components: {
            CityHeader,
            Search,
            List,
            Alphabet
        },
        methods:{
            getCityInfo () {
                axios.get('/api/city.json').then(this.getCityInfoSucc)   //请求本地配置的mock数据
            },
            getCityInfoSucc(res){
                 res = res.data
                if (res.ret && res.data) {
                    const data = res.data
                    this.hotCity = data.hotCities
                    this.cities = data.cities
                }
            }
        },
        mounted () {
            this.getCityInfo ()
        }
    }

     

    创建头部组件,

    <template>
        <div class="header">
            城市选择
            <router-link to="/">
                <div class="iconfont back-icon">&#xe624;</div>
            </router-link>
        </div>
    </template>
    
    <script>
    export default {
        
    }
    </script>
    
    <style scoped lang="stylus">
    @import '~styles/varibles.styl';
    @import '~styles/mixins.styl';
    .header
        overflow: hidden
        height $headerHeight
        line-height: $headerHeight
        text-align: center
        color: #fff
        background: $bgColor
        font-size: .4rem
        .back-icon
            position: absolute
            left: 0
            top: 0
            width: .64rem
            font-size: .4rem
            text-align: center
            color: #fff
    </style>

    创建搜索组件页面,接受父组件传递的数据,引入better-scroll第三方插件,实现列表滚动

    <template>
        <div>
            <div class="search">
                <input v-model="keyword" class="search-input" type="text" placeholder="输入城市名或者拼音" />
            </div>
            <div class="search-content" ref="search" v-show="keyword">
                <ul>
                    <li class="serach-item border-bottom" v-for="item in listItem" :key="item.id">{{item.name}}</li>
                    <li v-show="hasNoData" class="serach-item border-bottom">没有搜索到匹配的数据</li>
                </ul>
            </div>
        </div>
    </template>
    <script>
    import BScroll from 'better-scroll'
    export default {
        props: {
              list: Object,
        },
        data() {
            return {
                keyword:'',
                listItem:[],
                timer:null
            }
        },
        computed: {
            hasNoData() {
                return !this.listItem.length  //没有搜索的条件是否显示
            }
        },
        watch: {
            keyword () {
                if (this.timer) {
                    clearTimeout(this.timer)
                }
                if(!this.keyword) {  //清空
                    this.listItem = ""
                    return
                }
                this.timer = setTimeout(() => {
                    const result = []
                    for (let i in this.list) {
                        this.list[i].forEach((value) => {   //匹配搜索的条件
                            if (value.spell.indexOf(this.keyword) > -1 || value.name.indexOf(this.keyword) > -1) {
                                result.push(value)
                            }
                        })
                    }
                    this.listItem= result
                },100)
            }
        },
        mounted () {
            this.scroll = new BScroll(this.$refs.search)
        }
    }
    </script>
    
    <style scoped lang="stylus">
    @import '~styles/varibles.styl'
    @import '~styles/mixins.styl'
    .search
        height: .72rem
        padding: 0 .1rem
        background:$bgColor
        .search-input
            box-sizing: border-box
            width:100%
            height: .62rem
            line-height: .62rem
            text-align: center
            border-radius: .06rem
            padding: 0 .1rem
            color: #666
    .search-content 
        z-index: 1
        overflow:hidden
        position:absolute
        top: 1.58rem
        left: 0
        right: 0
        bottom: 0
        background: #eee
        .serach-item
            line-height: .62rem
            padding-left:.2rem
            color:#666
            background: #fff
    </style>

    创建城市列表组件,引入better-scroll插件,实现列表滚动,通过watch监听letter,实现字母与城市列表滚动

    <template>
        <div class="list" ref="wrapper">
            <div>
                <div class="area">
                    <div class="title border-topbottom">当前城市</div>
                    <div class="button-list">
                        <div class="button-wrapper">
                            <div class="button">郑州</div>
                        </div>
                    </div>
                </div>
                <div class="area">
                    <div class="title border-topbottom">热门城市</div>
                    <div class="button-list">
                        <div class="button-wrapper" v-for="item in hot" :key="item.id">
                            <div class="button">{{item.name}}</div>
                        </div>
                    </div>
                </div>
                <div class="area" 
                    v-for="(item,key) in list" 
                    :ref="key"
                    :key="key">
                    <div class="title border-topbottom">{{key}}</div>
                    <ul class="item-list">
                        <li class="item border-bottom"
                             v-for="listInner in item"
                              :key="listInner.id"
                        >{{listInner.name}}</li>
                    </ul>
                </div>
            </div>
        </div>
    </template>
    
    <script>
    import BScroll from 'better-scroll'
    export default {
        props: {
              hot: Array,
              list: Object,
              letter:String
          },
        mounted () {
            this.scroll = new BScroll(this.$refs.wrapper)
        },
        watch:{
            letter () {  //监听列表滚动事件 A-Z
                if(this.letter) {
                    const element = this.$refs[this.letter][0]
                    this.scroll.scrollToElement(element)
                }
            }
        }
    }
    </script>
    
    <style scoped lang="stylus">
    @import '~styles/varibles.styl';
    @import '~styles/mixins.styl';
    .border-topbottom
        &:before
            background: #ccc
        &:after
            background:#ccc
    .border-bottom
        &:before
            background: #ccc
    .list
        overflow: hidden
        position:absolute
        top:1.58rem
        left:0
        right:0
        bottom:0
        .title
            line-height: .54rem;
            background: #eee;
            padding-left: .2rem;
            color: #666;
            font-size: .26rem;
        .button-list
            overflow:hidden
            padding: .1rem .6rem .1rem .1rem
            .button-wrapper
                float:left
                width:33.33%
                .button
                    margin: .1rem
                    padding: .1rem 0
                    text-align: center
                    border: .02rem solid #ccc
                    border-radius: .06rem
        .item-list
            .item
                line-height: .76rem
                color:#212121
                padding-left: .2rem
                font-size: .28rem
                text-overflow: ellipsis
                white-space: nowrap
    </style>

    创建字母组件,点击字母,左边列表城市想对应,通过this.$emit事件,子组件在触发的事件传递给父组件,父组件通过子组件传递的事件,在传递给List组件,

    <template>
        <div class="list">
            <li class="item"
                :ref="item"
                 @click="handeClick" 
                 @touchstart="handleTouchStart" 
                 @touchmove="handleTouchMove" 
                 @touchend= "handleTouchEnd"
                 v-for="item of letter" 
                 :key="item">{{item}}</li>
        </div>
    </template>
    
    <script>
    export default {
        props: {
              list: Object
        },
        data () {
            return {
                touchstart:false,
                startY:0,
                timer: null
            }
        },
        updated () {
            this.startY = this.$refs['A'][0].offsetTop
        },
        computed: {
            letter () {
                const letter =[]
                for (let i in this.list) { //循环A-Z
                    letter.push(i)
                }
                return letter
            }
        },
        methods: {
            handeClick(e) {
                this.$emit('chang',e.target.innerText) //传给父组件City
            },
            handleTouchStart () {
                // 手指放上
                this.touchstart = true
            },
            handleTouchMove (e) {
                // 手指移动
                if(this.touchstart) {
                    if(this.timer) {
                        clearInterval(this.timer)
                    }
                    this.timer = setTimeout(() => {
                        const touchY = e.touches[0].clientY -79   //到蓝色头部的距离
                        const index = Math.floor((touchY - this.startY ) / 20)
                        if(index >=0 && index < this.letter.length) {
                            this.$emit('chang',this.letter[index])
                        }
                    },16)
                }
            },
            handleTouchEnd () {
                // 手指离开
                this.touchstart = false
            }
        }
    }
    </script>
    
    <style scoped lang="stylus">
    @import '~styles/varibles.styl';
    @import '~styles/mixins.styl';
    .list
        display: flex
        flex-direction:column
        justify-content: center
        position:absolute
        top: 1.58rem
        right: 0
        bottom: 0
        width: .4rem
        .item
            line-height:.44rem
            text-align: center
            color: $bgColor
            list-style:none
    </style>

     以上都是所有本次的内容,如果喜欢可以关注一下

    转载于:https://www.cnblogs.com/zhoulifeng/p/9316490.html

    展开全文
  • vue实现省份城市选择

    千次阅读 2019-07-03 09:53:31
    这次开发的是前端,客户没有提供城市选择的接口,省市这些数据感觉还是放在数据库后端操作较好。 数据和方法也是参考了别人博客的代码,直接贴代码 1 2 3 4 5 6 7 8 9 10...

    查看个人博客

    之前都是后端操作的,城市数据都是存在数据库的,前端选择然后去后端查的,比较简单方便。这次开发的是前端,客户没有提供城市选择的接口,省市这些数据感觉还是放在数据库后端操作较好。

    数据和方法也是参考了别人博客的代码,直接贴代码

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    <!--页面调用组件-->

    <atom-city ref="resetCountry"></atom-city>

     

       

    /*写在页面加载方法中,重置选择框中的值*/

    this.$refs.resetCountry.reset();

     

    /*写在提交方法中,从组件中获取选择的值*/

    var country = that.$refs.resetCountry.changeValueCountry()

    var province = that.$refs.resetCountry.changeValueProv()

    var city = that.$refs.resetCountry.changeValueCity()

     

    因为有多个页面需要使用,所以把选择城市的封装成atom-city组件,我这个需求是有选择国家的,如果选择的是中国才会有省份城市的选择框,否则用户自己输入省份城市,以下代码参考https://blog.csdn.net/lllo3o/article/details/72955701

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    21

    22

    23

    24

    25

    26

    27

    28

    29

    30

    31

    32

    33

    34

    35

    36

    37

    38

    39

    40

    41

    42

    43

    44

    45

    46

    47

    48

    49

    50

    51

    52

    53

    54

    55

    56

    57

    58

    59

    60

    61

    62

    63

    64

    65

    66

    67

    68

    69

    70

    71

    72

    73

    74

    75

    76

    77

    78

    79

    80

    81

    82

    83

    84

    85

    86

    87

    88

    89

    90

    91

    92

    93

    94

    95

    96

    97

    98

    99

    100

    101

    102

    103

    104

    105

    106

    107

    108

    109

    110

    111

    112

    113

    114

    115

    116

    117

    118

    119

    120

    121

    122

    123

    124

    125

    126

    127

    128

    129

    130

    131

    132

    133

    134

    135

    136

    137

    138

    139

    140

    141

    142

    143

    144

    145

    146

    147

    148

    149

    150

    151

    152

    153

    154

    155

    156

    157

    158

    159

    160

    161

    162

    163

    164

    165

    166

    167

    168

    169

    170

    171

    172

    173

    174

    175

    176

    177

    178

    179

    180

    181

    182

    183

    184

    185

    186

    187

    188

    189

    190

    191

    192

    193

    194

    195

    196

    197

    198

    199

    200

    201

    202

    203

    204

    205

    206

    207

    208

    209

    210

    211

    212

    213

    214

    215

    216

    217

    218

    219

    220

    221

    222

    223

    224

    225

    226

    227

    228

    229

    230

    231

    232

    233

    234

    235

    236

    237

    238

    239

    240

    241

    242

    243

    244

    245

    246

    247

    248

    249

    250

    251

    252

    253

    254

    255

    256

    257

    258

    259

    260

    261

    262

    263

    264

    265

    266

    267

    268

    269

    270

    271

    272

    273

    274

    275

    276

    277

    278

    279

    280

    281

    282

    283

    284

    285

    286

    287

    288

    289

    290

    291

    292

    293

    294

    295

    296

    297

    298

    299

    300

    301

    302

    303

    304

    305

    306

    307

    308

    309

    310

    311

    312

    313

    314

    315

    316

    317

    318

    319

    320

    321

    322

    323

    324

    325

    326

    327

    328

    329

    330

    331

    332

    333

    334

    335

    336

    337

    338

    339

    340

    341

    342

    343

    344

    345

    346

    347

    348

    349

    350

    351

    352

    353

    354

    355

    356

    357

    358

    359

    360

    361

    362

    363

    364

    365

    366

    367

    368

    369

    370

    371

    372

    373

    374

    375

    376

    377

    378

    379

    380

    381

    382

    383

    384

    385

    386

    387

    388

    389

    390

    391

    392

    393

    394

    395

    396

    397

    398

    399

    400

    401

    402

    403

    404

    405

    406

    407

    408

    409

    410

    411

    412

    413

    414

    415

    416

    417

    418

    419

    420

    421

    422

    423

    424

    425

    426

    427

    428

    429

    430

    431

    432

    433

    434

    435

    436

    437

    438

    439

    440

    441

    442

    443

    444

    445

    446

    447

    448

    449

    450

    451

    452

    453

    454

    455

    456

    457

    458

    459

    460

    461

    462

    463

    464

    465

    466

    467

    468

    469

    470

    471

    472

    473

    474

    475

    476

    477

    478

    479

    480

    481

    482

    483

    484

    485

    486

    487

    488

    489

    490

    491

    492

    493

    494

    495

    496

    497

    498

    499

    500

    501

    502

    503

    504

    505

    506

    507

    508

    509

    510

    511

    512

    513

    514

    515

    516

    517

    518

    519

    520

    521

    522

    523

    524

    525

    526

    527

    528

    529

    530

    531

    532

    533

    534

    535

    536

    537

    538

    539

    540

    541

    542

    543

    544

    545

    546

    547

    548

    549

    550

    551

    552

    553

    554

    555

    556

    557

    558

    559

    560

    561

    562

    563

    564

    565

    566

    567

    568

    569

    570

    571

    572

    573

    574

    575

    576

    577

    578

    579

    580

    581

    582

    583

    584

    585

    586

    587

    588

    589

    590

    591

    592

    593

    594

    595

    596

    597

    598

    599

    600

    601

    602

    603

    604

    605

    606

    607

    608

    609

    610

    611

    612

    613

    614

    615

    616

    617

    618

    619

    620

    621

    622

    623

    624

    625

    626

    627

    628

    629

    630

    631

    632

    633

    634

    635

    636

    637

    638

    639

    640

    641

    642

    643

    644

    645

    646

    647

    648

    649

    650

    651

    652

    653

    654

    655

    656

    657

    658

    659

    660

    661

    662

    663

    664

    665

    666

    667

    668

    669

    670

    671

    672

    673

    674

    675

    676

    677

    678

    679

    680

    681

    682

    683

    684

    685

    686

    687

    688

    689

    690

    691

    692

    693

    694

    695

    696

    697

    698

    699

    700

    701

    702

    703

    704

    705

    706

    707

    708

    709

    710

    711

    712

    713

    714

    715

    716

    717

    718

    719

    720

    721

    722

    723

    724

    725

    726

    727

    728

    729

    730

    731

    732

    733

    734

    735

    736

    737

    738

    739

    740

    741

    742

    743

    744

    745

    746

    747

    748

    749

    750

    751

    752

    753

    754

    755

    756

    757

    758

    759

    760

    761

    762

    763

    764

    765

    766

    767

    768

    769

    770

    771

    772

    773

    774

    775

    776

    777

    778

    779

    780

    781

    782

    783

    784

    785

    786

    787

    788

    789

    790

    791

    792

    793

    794

    795

    796

    797

    798

    799

    800

    801

    802

    803

    804

    805

    806

    807

    808

    809

    810

    811

    812

    813

    814

    815

    816

    817

    818

    819

    820

    821

    822

    823

    824

    825

    826

    827

    828

    829

    830

    831

    832

    833

    834

    835

    836

    837

    838

    839

    840

    841

    842

    843

    844

    845

    846

    847

    848

    849

    850

    851

    852

    853

    854

    855

    856

    857

    858

    859

    860

    861

    862

    863

    864

    865

    866

    867

    868

    869

    870

    871

    872

    873

    874

    875

    876

    877

    878

    879

    880

    881

    882

    883

    884

    885

    886

    887

    888

    889

    890

    891

    892

    893

    894

    895

    896

    897

    898

    899

    900

    901

    902

    903

    904

    905

    906

    907

    908

    909

    910

    911

    912

    913

    914

    915

    916

    917

    918

    919

    920

    921

    922

    923

    924

    925

    926

    927

    928

    929

    930

    931

    932

    933

    934

    935

    936

    937

    938

    939

    940

    941

    942

    943

    944

    945

    946

    947

    948

    949

    950

    951

    952

    953

    954

    955

    956

    957

    958

    959

    960

    961

    962

    963

    964

    965

    966

    967

    968

    969

    970

    971

    972

    973

    974

    975

    976

    977

    978

    979

    980

    981

    982

    983

    984

    985

    986

    987

    988

    989

    990

    991

    992

    993

    994

    995

    996

    997

    998

    999

    1000

    1001

    1002

    1003

    1004

    1005

    1006

    1007

    1008

    1009

    1010

    1011

    1012

    1013

    1014

    1015

    1016

    1017

    1018

    1019

    1020

    1021

    1022

    1023

    1024

    1025

    1026

    1027

    1028

    1029

    1030

    1031

    1032

    1033

    1034

    1035

    1036

    1037

    1038

    1039

    1040

    1041

    1042

    1043

    1044

    1045

    1046

    1047

    1048

    1049

    1050

    1051

    1052

    1053

    1054

    1055

    1056

    1057

    1058

    1059

    1060

    1061

    1062

    1063

    1064

    1065

    1066

    1067

    1068

    1069

    1070

    1071

    1072

    1073

    1074

    1075

    1076

    1077

    1078

    1079

    1080

    1081

    1082

    1083

    1084

    1085

    1086

    1087

    1088

    1089

    1090

    1091

    1092

    1093

    1094

    1095

    1096

    1097

    1098

    1099

    1100

    1101

    1102

    1103

    1104

    1105

    1106

    1107

    1108

    1109

    1110

    1111

    1112

    1113

    1114

    1115

    1116

    1117

    1118

    1119

    1120

    1121

    1122

    1123

    1124

    1125

    1126

    1127

    1128

    1129

    1130

    1131

    1132

    1133

    1134

    1135

    1136

    1137

    1138

    1139

    1140

    1141

    1142

    1143

    1144

    1145

    1146

    1147

    1148

    1149

    1150

    1151

    1152

    1153

    1154

    1155

    1156

    1157

    1158

    1159

    1160

    1161

    1162

    1163

    1164

    1165

    1166

    1167

    1168

    1169

    1170

    1171

    1172

    1173

    1174

    1175

    1176

    1177

    1178

    1179

    1180

    1181

    1182

    1183

    1184

    1185

    1186

    1187

    1188

    1189

    1190

    1191

    1192

    1193

    1194

    1195

    1196

    1197

    1198

    1199

    1200

    1201

    1202

    1203

    1204

    1205

    1206

    1207

    1208

    1209

    1210

    1211

    1212

    1213

    1214

    1215

    1216

    1217

    1218

    1219

    1220

    1221

    1222

    1223

    1224

    1225

    1226

    1227

    1228

    1229

    1230

    1231

    1232

    1233

    1234

    1235

    1236

    1237

    1238

    1239

    1240

    1241

    1242

    1243

    1244

    1245

    1246

    1247

    1248

    1249

    1250

    1251

    1252

    1253

    1254

    1255

    1256

    1257

    1258

    1259

    1260

    1261

    1262

    1263

    1264

    1265

    1266

    1267

    1268

    1269

    1270

    1271

    1272

    1273

    1274

    1275

    1276

    1277

    1278

    1279

    <template>

      <div>

        <div class="form-group">

          <label>{{$t('account.countryAdd')}}</label>

          <div class="input-group height-fix-6">

              <div class="input-group-prepend"><span class="input-group-text">#</span></div>

              <select class="form-control" v-model="selectCountry" v-on:change="getCount($event)">

                  <option value="" selected>{{$t('message.pleaseEnter')}}</option>

                  <option v-for="item in countrys" :label="item.label" :value="item.value">{{item.value}}</option>

              </select>

          </div>

        </div>

        <div class="form-group">

            <div v-if="selectCountry=='中国'">

              <label>{{$t('account.provinceAdd')}}</label>

              <div class="input-group height-fix-6">

                <div class="input-group-prepend"><span class="input-group-text">#</span></div>

              <select class="form-control" v-model="selectProv" v-on:change="getProv($event)">

                <option value="" selected>{{$t('message.pleaseEnter')}}</option>

                  <option v-for="item in provs" :label="item.label" :value="item.value">{{item.value}}</option>

              </select>

            </div>

            <div v-if="selectProv!=''">

              <label>{{$t('account.cityAdd')}}</label>

              <div class="input-group height-fix-6">

                <div class="input-group-prepend"><span class="input-group-text">#</span></div>

                <select class="form-control" v-model="selectCity" v-on:change="getCity($event)">

                   <option value="" selected>{{$t('message.pleaseEnter')}}</option>

                    <option v-for="item in citys" :label="item.label" :value="item.value">{{item.value}} </option>

                </select>

              </div>

            </div>

          </div>

          <div v-if="selectCountry!='中国' && selectCountry!=''" >

              <label>{{$t('account.provinceAdd')}}</label>

              <div class="input-group height-fix-6">

                <div class="input-group-prepend"><span class="input-group-text">#</span></div>

                <input type="text" v-model="selectProv" class="form-control" :placeholder="$i18n.t('message.pleaseEnter')">

              </div>

              <label>{{$t('account.cityAdd')}}</label>

              <div class="input-group height-fix-6">

                <div class="input-group-prepend"><span class="input-group-text">#</span></div>

                <input type="text" v-model="selectCity" class="form-control" :placeholder="$i18n.t('message.pleaseEnter')">

              </div>

          </div>

     

        </div>

      </div>

    </template>

     

    <script>

    export default {

      name: 'atom-city',

      data(){

        return{

          countrys:[{label:"中国",value:"中国"},

                    {label:"日本",value:"日本"},

                    {label:"美国",value:"美国"},

                    {label:"韩国",value:"韩国"},

                    {label:"印度",value:"印度"}

          ],

          provs:[{label:"北京市",value:"北京市"},

                {label:"天津市",value:"天津市"},

                {label:"河北省",value:"河北省"},

                {label:"山西省",value:"山西省"},

                {label:"内蒙古自治区",value:"内蒙古自治区"},

                {label:"辽宁省",value:"辽宁省"},

                {label:"吉林省",value:"吉林省"},

                {label:"黑龙江省",value:"黑龙江省"},

                {label:"上海市",value:"上海市"},

                {label:"江苏省",value:"江苏省"},

                {label:"浙江省",value:"浙江省"},

                {label:"安徽省",value:"安徽省"},

                {label:"福建省",value:"福建省"},

                {label:"江西省",value:"江西省"},

                {label:"山东省",value:"山东省"},

                {label:"河南省",value:"河南省"},

                {label:"湖北省",value:"湖北省"},

                {label:"湖南省",value:"湖南省"},

                {label:"广东省",value:"广东省"},

                {label:"广西壮族自治区",value:"广西壮族自治区"},

                {label:"海南省",value:"海南省"},

                {label:"重庆市",value:"重庆市"},

                {label:"四川省",value:"四川省"},

                {label:"贵州省",value:"贵州省"},

                {label:"云南省",value:"云南省"},

                {label:"西藏自治区",value:"西藏自治区"},

                {label:"陕西省",value:"陕西省"},

                {label:"甘肃省",value:"甘肃省"},

                {label:"青海省",value:"青海省"},

                {label:"宁夏回族自治区",value:"宁夏回族自治区"},

                {label:"新疆维吾尔自治区",value:"新疆维吾尔自治区"},

                {label:"台湾省",value:"台湾省"},

                {label:"香港特别行政区",value:"香港特别行政区"},

                {label:"澳门特别行政区",value:"澳门特别行政区"}] ,

                    citys: [],

                    selectProv: '',

                    selectCity: '',

                    selectCountry:''

        }

      },

      methods: {

        /*二级联动选择地区*/

                getProv: function (prov) {

                    let tempCity=[];             

                    this.citys=[];

                    this.selectCity='';               

                    let allCity=[{

                        prov: "北京市",

                        label: "北京市"

                    }, {

                        prov: "天津市",

                        label: "天津市"

                    }, {

                        prov: "河北省",

                        label: "石家庄市"

                    }, {

                        prov: "河北省",

                        label: "唐山市"

                    }, {

                        prov: "河北省",

                        label: "秦皇岛市"

                    }, {

                        prov: "河北省",

                        label: "邯郸市"

                    }, {

                        prov: "河北省",

                        label: "邢台市"

                    }, {

                        prov: "河北省",

                        label: "保定市"

                    }, {

                        prov: "河北省",

                        label: "张家口市"

                    }, {

                        prov: "河北省",

                        label: "承德市"

                    }, {

                        prov: "河北省",

                        label: "沧州市"

                    }, {

                        prov: "河北省",

                        label: "廊坊市"

                    }, {

                        prov: "河北省",

                        label: "衡水市"

                    }, {

                        prov: "山西省",

                        label: "太原市"

                    }, {

                        prov: "山西省",

                        label: "大同市"

                    }, {

                        prov: "山西省",

                        label: "阳泉市"

                    }, {

                        prov: "山西省",

                        label: "长治市"

                    }, {

                        prov: "山西省",

                        label: "晋城市"

                    }, {

                        prov: "山西省",

                        label: "朔州市"

                    }, {

                        prov: "山西省",

                        label: "晋中市"

                    }, {

                        prov: "山西省",

                        label: "运城市"

                    }, {

                        prov: "山西省",

                        label: "忻州市"

                    }, {

                        prov: "山西省",

                        label: "临汾市"

                    }, {

                        prov: "山西省",

                        label: "吕梁市"

                    }, {

                        prov: "内蒙古自治区",

                        label: "呼和浩特市"

                    }, {

                        prov: "内蒙古自治区",

                        label: "包头市"

                    }, {

                        prov: "内蒙古自治区",

                        label: "乌海市"

                    }, {

                        prov: "内蒙古自治区",

                        label: "赤峰市"

                    }, {

                        prov: "内蒙古自治区",

                        label: "通辽市"

                    }, {

                        prov: "内蒙古自治区",

                        label: "鄂尔多斯市"

                    }, {

                        prov: "内蒙古自治区",

                        label: "呼伦贝尔市"

                    }, {

                        prov: "内蒙古自治区",

                        label: "巴彦淖尔市"

                    }, {

                        prov: "内蒙古自治区",

                        label: "乌兰察布市"

                    }, {

                        prov: "内蒙古自治区",

                        label: "兴安盟"

                    }, {

                        prov: "内蒙古自治区",

                        label: "锡林郭勒盟"

                    }, {

                        prov: "内蒙古自治区",

                        label: "阿拉善盟"

                    }, {

                        prov: "辽宁省",

                        label: "沈阳市"

                    }, {

                        prov: "辽宁省",

                        label: "大连市"

                    }, {

                        prov: "辽宁省",

                        label: "鞍山市"

                    }, {

                        prov: "辽宁省",

                        label: "抚顺市"

                    }, {

                        prov: "辽宁省",

                        label: "本溪市"

                    }, {

                        prov: "辽宁省",

                        label: "丹东市"

                    }, {

                        prov: "辽宁省",

                        label: "锦州市"

                    }, {

                        prov: "辽宁省",

                        label: "营口市"

                    }, {

                        prov: "辽宁省",

                        label: "阜新市"

                    }, {

                        prov: "辽宁省",

                        label: "辽阳市"

                    }, {

                        prov: "辽宁省",

                        label: "盘锦市"

                    }, {

                        prov: "辽宁省",

                        label: "铁岭市"

                    }, {

                        prov: "辽宁省",

                        label: "朝阳市"

                    }, {

                        prov: "辽宁省",

                        label: "葫芦岛市"

                    }, {

                        prov: "吉林省",

                        label: "长春市"

                    }, {

                        prov: "吉林省",

                        label: "吉林市"

                    }, {

                        prov: "吉林省",

                        label: "四平市"

                    }, {

                        prov: "吉林省",

                        label: "辽源市"

                    }, {

                        prov: "吉林省",

                        label: "通化市"

                    }, {

                        prov: "吉林省",

                        label: "白山市"

                    }, {

                        prov: "吉林省",

                        label: "松原市"

                    }, {

                        prov: "吉林省",

                        label: "白城市"

                    }, {

                        prov: "吉林省",

                        label: "延边朝鲜族自治州"

                    }, {

                        prov: "黑龙江省",

                        label: "哈尔滨市"

                    }, {

                        prov: "黑龙江省",

                        label: "齐齐哈尔市"

                    }, {

                        prov: "黑龙江省",

                        label: "鸡西市"

                    }, {

                        prov: "黑龙江省",

                        label: "鹤岗市"

                    }, {

                        prov: "黑龙江省",

                        label: "双鸭山市"

                    }, {

                        prov: "黑龙江省",

                        label: "大庆市"

                    }, {

                        prov: "黑龙江省",

                        label: "伊春市"

                    }, {

                        prov: "黑龙江省",

                        label: "佳木斯市"

                    }, {

                        prov: "黑龙江省",

                        label: "七台河市"

                    }, {

                        prov: "黑龙江省",

                        label: "牡丹江市"

                    }, {

                        prov: "黑龙江省",

                        label: "黑河市"

                    }, {

                        prov: "黑龙江省",

                        label: "绥化市"

                    }, {

                        prov: "黑龙江省",

                        label: "大兴安岭地区"

                    }, {

                        prov: "上海市",

                        label: "上海市"

                    }, {

                        prov: "江苏省",

                        label: "南京市"

                    }, {

                        prov: "江苏省",

                        label: "无锡市"

                    }, {

                        prov: "江苏省",

                        label: "徐州市"

                    }, {

                        prov: "江苏省",

                        label: "常州市"

                    }, {

                        prov: "江苏省",

                        label: "苏州市"

                    }, {

                        prov: "江苏省",

                        label: "南通市"

                    }, {

                        prov: "江苏省",

                        label: "连云港市"

                    }, {

                        prov: "江苏省",

                        label: "淮安市"

                    }, {

                        prov: "江苏省",

                        label: "盐城市"

                    }, {

                        prov: "江苏省",

                        label: "扬州市"

                    }, {

                        prov: "江苏省",

                        label: "镇江市"

                    }, {

                        prov: "江苏省",

                        label: "泰州市"

                    }, {

                        prov: "江苏省",

                        label: "宿迁市"

                    }, {

                        prov: "浙江省",

                        label: "杭州市"

                    }, {

                        prov: "浙江省",

                        label: "宁波市"

                    }, {

                        prov: "浙江省",

                        label: "温州市"

                    }, {

                        prov: "浙江省",

                        label: "嘉兴市"

                    }, {

                        prov: "浙江省",

                        label: "湖州市"

                    }, {

                        prov: "浙江省",

                        label: "绍兴市"

                    }, {

                        prov: "浙江省",

                        label: "金华市"

                    }, {

                        prov: "浙江省",

                        label: "衢州市"

                    }, {

                        prov: "浙江省",

                        label: "舟山市"

                    }, {

                        prov: "浙江省",

                        label: "台州市"

                    }, {

                        prov: "浙江省",

                        label: "丽水市"

                    }, {

                        prov: "安徽省",

                        label: "合肥市"

                    }, {

                        prov: "安徽省",

                        label: "芜湖市"

                    }, {

                        prov: "安徽省",

                        label: "蚌埠市"

                    }, {

                        prov: "安徽省",

                        label: "淮南市"

                    }, {

                        prov: "安徽省",

                        label: "马鞍山市"

                    }, {

                        prov: "安徽省",

                        label: "淮北市"

                    }, {

                        prov: "安徽省",

                        label: "铜陵市"

                    }, {

                        prov: "安徽省",

                        label: "安庆市"

                    }, {

                        prov: "安徽省",

                        label: "黄山市"

                    }, {

                        prov: "安徽省",

                        label: "滁州市"

                    }, {

                        prov: "安徽省",

                        label: "阜阳市"

                    }, {

                        prov: "安徽省",

                        label: "宿州市"

                    }, {

                        prov: "安徽省",

                        label: "六安市"

                    }, {

                        prov: "安徽省",

                        label: "亳州市"

                    }, {

                        prov: "安徽省",

                        label: "池州市"

                    }, {

                        prov: "安徽省",

                        label: "宣城市"

                    }, {

                        prov: "福建省",

                        label: "福州市"

                    }, {

                        prov: "福建省",

                        label: "厦门市"

                    }, {

                        prov: "福建省",

                        label: "莆田市"

                    }, {

                        prov: "福建省",

                        label: "三明市"

                    }, {

                        prov: "福建省",

                        label: "泉州市"

                    }, {

                        prov: "福建省",

                        label: "漳州市"

                    }, {

                        prov: "福建省",

                        label: "南平市"

                    }, {

                        prov: "福建省",

                        label: "龙岩市"

                    }, {

                        prov: "福建省",

                        label: "宁德市"

                    }, {

                        prov: "江西省",

                        label: "南昌市"

                    }, {

                        prov: "江西省",

                        label: "景德镇市"

                    }, {

                        prov: "江西省",

                        label: "萍乡市"

                    }, {

                        prov: "江西省",

                        label: "九江市"

                    }, {

                        prov: "江西省",

                        label: "新余市"

                    }, {

                        prov: "江西省",

                        label: "鹰潭市"

                    }, {

                        prov: "江西省",

                        label: "赣州市"

                    }, {

                        prov: "江西省",

                        label: "吉安市"

                    }, {

                        prov: "江西省",

                        label: "宜春市"

                    }, {

                        prov: "江西省",

                        label: "抚州市"

                    }, {

                        prov: "江西省",

                        label: "上饶市"

                    }, {

                        prov: "山东省",

                        label: "济南市"

                    }, {

                        prov: "山东省",

                        label: "青岛市"

                    }, {

                        prov: "山东省",

                        label: "淄博市"

                    }, {

                        prov: "山东省",

                        label: "枣庄市"

                    }, {

                        prov: "山东省",

                        label: "东营市"

                    }, {

                        prov: "山东省",

                        label: "烟台市"

                    }, {

                        prov: "山东省",

                        label: "潍坊市"

                    }, {

                        prov: "山东省",

                        label: "济宁市"

                    }, {

                        prov: "山东省",

                        label: "泰安市"

                    }, {

                        prov: "山东省",

                        label: "威海市"

                    }, {

                        prov: "山东省",

                        label: "日照市"

                    }, {

                        prov: "山东省",

                        label: "莱芜市"

                    }, {

                        prov: "山东省",

                        label: "临沂市"

                    }, {

                        prov: "山东省",

                        label: "德州市"

                    }, {

                        prov: "山东省",

                        label: "聊城市"

                    }, {

                        prov: "山东省",

                        label: "滨州市"

                    }, {

                        prov: "山东省",

                        label: "菏泽市"

                    }, {

                        prov: "河南省",

                        label: "郑州市"

                    }, {

                        prov: "河南省",

                        label: "开封市"

                    }, {

                        prov: "河南省",

                        label: "洛阳市"

                    }, {

                        prov: "河南省",

                        label: "平顶山市"

                    }, {

                        prov: "河南省",

                        label: "安阳市"

                    }, {

                        prov: "河南省",

                        label: "鹤壁市"

                    }, {

                        prov: "河南省",

                        label: "新乡市"

                    }, {

                        prov: "河南省",

                        label: "焦作市"

                    }, {

                        prov: "河南省",

                        label: "濮阳市"

                    }, {

                        prov: "河南省",

                        label: "许昌市"

                    }, {

                        prov: "河南省",

                        label: "漯河市"

                    }, {

                        prov: "河南省",

                        label: "三门峡市"

                    }, {

                        prov: "河南省",

                        label: "南阳市"

                    }, {

                        prov: "河南省",

                        label: "商丘市"

                    }, {

                        prov: "河南省",

                        label: "信阳市"

                    }, {

                        prov: "河南省",

                        label: "周口市"

                    }, {

                        prov: "河南省",

                        label: "驻马店市"

                    }, {

                        prov: "河南省",

                        label: "省直辖县级行政区划"

                    }, {

                        prov: "湖北省",

                        label: "武汉市"

                    }, {

                        prov: "湖北省",

                        label: "黄石市"

                    }, {

                        prov: "湖北省",

                        label: "十堰市"

                    }, {

                        prov: "湖北省",

                        label: "宜昌市"

                    }, {

                        prov: "湖北省",

                        label: "襄阳市"

                    }, {

                        prov: "湖北省",

                        label: "鄂州市"

                    }, {

                        prov: "湖北省",

                        label: "荆门市"

                    }, {

                        prov: "湖北省",

                        label: "孝感市"

                    }, {

                        prov: "湖北省",

                        label: "荆州市"

                    }, {

                        prov: "湖北省",

                        label: "黄冈市"

                    }, {

                        prov: "湖北省",

                        label: "咸宁市"

                    }, {

                        prov: "湖北省",

                        label: "随州市"

                    }, {

                        prov: "湖北省",

                        label: "恩施土家族苗族自治州"

                    }, {

                        prov: "湖北省",

                        label: "省直辖县级行政区划"

                    }, {

                        prov: "湖北省",

                        label: "仙桃市"

                    }, {

                        prov: "湖北省",

                        label: "潜江市"

                    }, {

                        prov: "湖北省",

                        label: "天门市"

                    }, {

                        prov: "湖北省",

                        label: "神农架林区"

                    }, {

                        prov: "湖南省",

                        label: "长沙市"

                    }, {

                        prov: "湖南省",

                        label: "株洲市"

                    }, {

                        prov: "湖南省",

                        label: "湘潭市"

                    }, {

                        prov: "湖南省",

                        label: "衡阳市"

                    }, {

                        prov: "湖南省",

                        label: "邵阳市"

                    }, {

                        prov: "湖南省",

                        label: "岳阳市"

                    }, {

                        prov: "湖南省",

                        label: "常德市"

                    }, {

                        prov: "湖南省",

                        label: "张家界市"

                    }, {

                        prov: "湖南省",

                        label: "益阳市"

                    }, {

                        prov: "湖南省",

                        label: "郴州市"

                    }, {

                        prov: "湖南省",

                        label: "永州市"

                    }, {

                        prov: "湖南省",

                        label: "怀化市"

                    }, {

                        prov: "湖南省",

                        label: "娄底市"

                    }, {

                        prov: "湖南省",

                        label: "湘西土家族苗族自治州"

                    }, {

                        prov: "广东省",

                        label: "广州市"

                    }, {

                        prov: "广东省",

                        label: "韶关市"

                    }, {

                        prov: "广东省",

                        label: "深圳市"

                    }, {

                        prov: "广东省",

                        label: "珠海市"

                    }, {

                        prov: "广东省",

                        label: "汕头市"

                    }, {

                        prov: "广东省",

                        label: "佛山市"

                    }, {

                        prov: "广东省",

                        label: "江门市"

                    }, {

                        prov: "广东省",

                        label: "湛江市"

                    }, {

                        prov: "广东省",

                        label: "茂名市"

                    }, {

                        prov: "广东省",

                        label: "肇庆市"

                    }, {

                        prov: "广东省",

                        label: "惠州市"

                    }, {

                        prov: "广东省",

                        label: "梅州市"

                    }, {

                        prov: "广东省",

                        label: "汕尾市"

                    }, {

                        prov: "广东省",

                        label: "河源市"

                    }, {

                        prov: "广东省",

                        label: "阳江市"

                    }, {

                        prov: "广东省",

                        label: "清远市"

                    }, {

                        prov: "广东省",

                        label: "东莞市"

                    }, {

                        prov: "广东省",

                        label: "中山市"

                    }, {

                        prov: "广东省",

                        label: "潮州市"

                    }, {

                        prov: "广东省",

                        label: "揭阳市"

                    }, {

                        prov: "广东省",

                        label: "云浮市"

                    }, {

                        prov: "广西壮族自治区",

                        label: "南宁市"

                    }, {

                        prov: "广西壮族自治区",

                        label: "柳州市"

                    }, {

                        prov: "广西壮族自治区",

                        label: "桂林市"

                    }, {

                        prov: "广西壮族自治区",

                        label: "梧州市"

                    }, {

                        prov: "广西壮族自治区",

                        label: "北海市"

                    }, {

                        prov: "广西壮族自治区",

                        label: "防城港市"

                    }, {

                        prov: "广西壮族自治区",

                        label: "钦州市"

                    }, {

                        prov: "广西壮族自治区",

                        label: "贵港市"

                    }, {

                        prov: "广西壮族自治区",

                        label: "玉林市"

                    }, {

                        prov: "广西壮族自治区",

                        label: "百色市"

                    }, {

                        prov: "广西壮族自治区",

                        label: "贺州市"

                    }, {

                        prov: "广西壮族自治区",

                        label: "河池市"

                    }, {

                        prov: "广西壮族自治区",

                        label: "来宾市"

                    }, {

                        prov: "广西壮族自治区",

                        label: "崇左市"

                    }, {

                        prov: "海南省",

                        label: "海口市"

                    }, {

                        prov: "海南省",

                        label: "三亚市"

                    }, {

                        prov: "海南省",

                        label: "三沙市"

                    }, {

                        prov: "海南省",

                        label: "省直辖县级行政区划"

                    }, {

                        prov: "海南省",

                        label: "五指山市"

                    }, {

                        prov: "海南省",

                        label: "琼海市"

                    }, {

                        prov: "海南省",

                        label: "儋州市"

                    }, {

                        prov: "海南省",

                        label: "文昌市"

                    }, {

                        prov: "海南省",

                        label: "万宁市"

                    }, {

                        prov: "海南省",

                        label: "东方市"

                    }, {

                        prov: "海南省",

                        label: "定安县"

                    }, {

                        prov: "海南省",

                        label: "屯昌县"

                    }, {

                        prov: "海南省",

                        label: "澄迈县"

                    }, {

                        prov: "海南省",

                        label: "临高县"

                    }, {

                        prov: "海南省",

                        label: "白沙黎族自治县"

                    }, {

                        prov: "海南省",

                        label: "昌江黎族自治县"

                    }, {

                        prov: "海南省",

                        label: "乐东黎族自治县"

                    }, {

                        prov: "海南省",

                        label: "陵水黎族自治县"

                    }, {

                        prov: "海南省",

                        label: "保亭黎族苗族自治县"

                    }, {

                        prov: "海南省",

                        label: "琼中黎族苗族自治县"

                    }, {

                        prov: "重庆市",

                        label: "重庆市"

                    }, {

                        prov: "四川省",

                        label: "成都市"

                    }, {

                        prov: "四川省",

                        label: "自贡市"

                    }, {

                        prov: "四川省",

                        label: "攀枝花市"

                    }, {

                        prov: "四川省",

                        label: "泸州市"

                    }, {

                        prov: "四川省",

                        label: "德阳市"

                    }, {

                        prov: "四川省",

                        label: "绵阳市"

                    }, {

                        prov: "四川省",

                        label: "广元市"

                    }, {

                        prov: "四川省",

                        label: "遂宁市"

                    }, {

                        prov: "四川省",

                        label: "内江市"

                    }, {

                        prov: "四川省",

                        label: "乐山市"

                    }, {

                        prov: "四川省",

                        label: "南充市"

                    }, {

                        prov: "四川省",

                        label: "眉山市"

                    }, {

                        prov: "四川省",

                        label: "宜宾市"

                    }, {

                        prov: "四川省",

                        label: "广安市"

                    }, {

                        prov: "四川省",

                        label: "达州市"

                    }, {

                        prov: "四川省",

                        label: "雅安市"

                    }, {

                        prov: "四川省",

                        label: "巴中市"

                    }, {

                        prov: "四川省",

                        label: "资阳市"

                    }, {

                        prov: "四川省",

                        label: "阿坝藏族羌族自治州"

                    }, {

                        prov: "四川省",

                        label: "甘孜藏族自治州"

                    }, {

                        prov: "四川省",

                        label: "凉山彝族自治州"

                    }, {

                        prov: "贵州省",

                        label: "贵阳市"

                    }, {

                        prov: "贵州省",

                        label: "六盘水市"

                    }, {

                        prov: "贵州省",

                        label: "遵义市"

                    }, {

                        prov: "贵州省",

                        label: "安顺市"

                    }, {

                        prov: "贵州省",

                        label: "毕节市"

                    }, {

                        prov: "贵州省",

                        label: "铜仁市"

                    }, {

                        prov: "贵州省",

                        label: "黔西南布依族苗族自治州"

                    }, {

                        prov: "贵州省",

                        label: "黔东南苗族侗族自治州"

                    }, {

                        prov: "贵州省",

                        label: "黔南布依族苗族自治州"

                    }, {

                        prov: "云南省",

                        label: "昆明市"

                    }, {

                        prov: "云南省",

                        label: "曲靖市"

                    }, {

                        prov: "云南省",

                        label: "玉溪市"

                    }, {

                        prov: "云南省",

                        label: "保山市"

                    }, {

                        prov: "云南省",

                        label: "昭通市"

                    }, {

                        prov: "云南省",

                        label: "丽江市"

                    }, {

                        prov: "云南省",

                        label: "普洱市"

                    }, {

                        prov: "云南省",

                        label: "临沧市"

                    }, {

                        prov: "云南省",

                        label: "楚雄彝族自治州"

                    }, {

                        prov: "云南省",

                        label: "红河哈尼族彝族自治州"

                    }, {

                        prov: "云南省",

                        label: "文山壮族苗族自治州"

                    }, {

                        prov: "云南省",

                        label: "西双版纳傣族自治州"

                    }, {

                        prov: "云南省",

                        label: "大理白族自治州"

                    }, {

                        prov: "云南省",

                        label: "德宏傣族景颇族自治州"

                    }, {

                        prov: "云南省",

                        label: "怒江傈僳族自治州"

                    }, {

                        prov: "云南省",

                        label: "迪庆藏族自治州"

                    }, {

                        prov: "西藏自治区",

                        label: "拉萨市"

                    }, {

                        prov: "西藏自治区",

                        label: "昌都地区"

                    }, {

                        prov: "西藏自治区",

                        label: "山南地区"

                    }, {

                        prov: "西藏自治区",

                        label: "日喀则地区"

                    }, {

                        prov: "西藏自治区",

                        label: "那曲地区"

                    }, {

                        prov: "西藏自治区",

                        label: "阿里地区"

                    }, {

                        prov: "西藏自治区",

                        label: "林芝地区"

                    }, {

                        prov: "陕西省",

                        label: "西安市"

                    }, {

                        prov: "陕西省",

                        label: "铜川市"

                    }, {

                        prov: "陕西省",

                        label: "宝鸡市"

                    }, {

                        prov: "陕西省",

                        label: "咸阳市"

                    }, {

                        prov: "陕西省",

                        label: "渭南市"

                    }, {

                        prov: "陕西省",

                        label: "延安市"

                    }, {

                        prov: "陕西省",

                        label: "汉中市"

                    }, {

                        prov: "陕西省",

                        label: "榆林市"

                    }, {

                        prov: "陕西省",

                        label: "安康市"

                    }, {

                        prov: "陕西省",

                        label: "商洛市"

                    }, {

                        prov: "甘肃省",

                        label: "兰州市"

                    }, {

                        prov: "甘肃省",

                        label: "嘉峪关市"

                    }, {

                        prov: "甘肃省",

                        label: "金昌市"

                    }, {

                        prov: "甘肃省",

                        label: "白银市"

                    }, {

                        prov: "甘肃省",

                        label: "天水市"

                    }, {

                        prov: "甘肃省",

                        label: "武威市"

                    }, {

                        prov: "甘肃省",

                        label: "张掖市"

                    }, {

                        prov: "甘肃省",

                        label: "平凉市"

                    }, {

                        prov: "甘肃省",

                        label: "酒泉市"

                    }, {

                        prov: "甘肃省",

                        label: "庆阳市"

                    }, {

                        prov: "甘肃省",

                        label: "定西市"

                    }, {

                        prov: "甘肃省",

                        label: "陇南市"

                    }, {

                        prov: "甘肃省",

                        label: "临夏回族自治州"

                    }, {

                        prov: "甘肃省",

                        label: "甘南藏族自治州"

                    }, {

                        prov: "青海省",

                        label: "西宁市"

                    }, {

                        prov: "青海省",

                        label: "海东市"

                    }, {

                        prov: "青海省",

                        label: "海北藏族自治州"

                    }, {

                        prov: "青海省",

                        label: "黄南藏族自治州"

                    }, {

                        prov: "青海省",

                        label: "海南藏族自治州"

                    }, {

                        prov: "青海省",

                        label: "果洛藏族自治州"

                    }, {

                        prov: "青海省",

                        label: "玉树藏族自治州"

                    }, {

                        prov: "青海省",

                        label: "海西蒙古族藏族自治州"

                    }, {

                        prov: "宁夏回族自治区",

                        label: "银川市"

                    }, {

                        prov: "宁夏回族自治区",

                        label: "石嘴山市"

                    }, {

                        prov: "宁夏回族自治区",

                        label: "吴忠市"

                    }, {

                        prov: "宁夏回族自治区",

                        label: "固原市"

                    }, {

                        prov: "宁夏回族自治区",

                        label: "中卫市"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "乌鲁木齐市"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "克拉玛依市"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "吐鲁番地区"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "哈密地区"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "昌吉回族自治州"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "博尔塔拉蒙古自治州"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "巴音郭楞蒙古自治州"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "阿克苏地区"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "克孜勒苏柯尔克孜自治州"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "喀什地区"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "和田地区"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "伊犁哈萨克自治州"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "塔城地区"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "阿勒泰地区"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "自治区直辖县级行政区划"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "石河子市"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "阿拉尔市"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "图木舒克市"

                    }, {

                        prov: "新疆维吾尔自治区",

                        label: "五家渠市"

                    }, {

                        prov: "台湾省",

                        label: "台北市"

                    }, {

                        prov: "台湾省",

                        label: "高雄市"

                    }, {

                        prov: "台湾省",

                        label: "基隆市"

                    }, {

                        prov: "台湾省",

                        label: "台中市"

                    }, {

                        prov: "台湾省",

                        label: "台南市"

                    }, {

                        prov: "台湾省",

                        label: "新竹市"

                    }, {

                        prov: "台湾省",

                        label: "嘉义市"

                    }, {

                        prov: "台湾省",

                        label: "省直辖"

                    }, {

                        prov: "香港特别行政区",

                        label: "香港岛"

                    }, {

                        prov: "香港特别行政区",

                        label: "九龙"

                    }, {

                        prov: "香港特别行政区",

                        label: "新界"

                    }, {

                        prov: "澳门特别行政区",

                        label: "澳门半岛"

                    }, {

                        prov: "澳门特别行政区",

                        label: "澳门离岛"

                    }, {

                        prov: "澳门特别行政区",

                        label: "无堂区划分区域"

                    }];

                    for (var val of allCity){

                        if (this.selectProv == val.prov){

                            console.log(val);

                            tempCity.push({label: val.label, value: val.label})

                        }

                    }

                    this.citys = tempCity;

                },

                getCity: function (city) {

                    console.log(city);

                    console.log(this.selectCity)

                },

                getCount: function(country) {

                  this.selectProv='';

                  this.citys=[];

                  this.selectCity='';

                },

                reset: function() {

                  this.selectProv= '';

                  this.selectCity='';

                  this.selectCountry='';

                },

                changeValueCountry: function(event){

                    return this.selectCountry

                },

                changeValueProv: function(event){

                    return this.selectProv

                },

                changeValueCity: function(event){

                    return this.selectCity

                }

      }

    }

    </script>

     

    其他方式参考:

    vue.js 省份城市联动选择实现示例(通过vue数组过滤)

    基于vue2实现省市联动

     

    展开全文
  • web端h5+vue.js实现城市选择页面和选择城市功能,完美流畅侧滑效果
  • Vue实现数据共享 数据共享,我们使用到vuex这个状态管理模式。 https://vuex.vuejs.org/zh/ 可进此网站了解。 其实数据共享就是,我创建了一个index.js文件,定义一个数据,让我的其他首页使用这个数据就可以啦,...

    Vue实现数据共享

    数据共享,我们使用到vuex这个状态管理模式。
    https://vuex.vuejs.org/zh/ 可进此网站了解。

    其实数据共享就是,我创建了一个index.js文件,定义一个数据,让我的其他首页使用这个数据就可以啦,如果改变数据,那么就改变index.js文件的数据,那么多个数据都会同时变化。

    cnpm install vuex --save 下载

    如何共享数据呢。

    1. 我创建了一个文件夹store,里面的index.js文件,让city: ‘上海’
      在这里插入图片描述
    2. 全局引入stroe/index.js
      在这里插入图片描述
    3. 需要共享的数据。
      在这里插入图片描述
    4. 想点击另外一个城市之后共享数据变化,创建点击事件,并且传此点击的值进去。
      在这里插入图片描述
    5. 调用此方法后,会将共享值在stroe/index.js的city的值改变,实现共享 在这里插入图片描述
    6. 会调用index.js里面的。
      在这里插入图片描述
    7. 最后会自动返回到某页,用的是这个方法,跳到了首页。
      在这里插入图片描述
    展开全文
  • 1,效果展示:  2,主要问题: ... 1)传值问题,没有写很多组件,... Vue实现锚点: https://blog.csdn.net/Null_Bugs/article/details/80930166    ----整理,创作不易,有空,请点个赞啦,谢谢!
  • 文章目录为input框绑定v-...去父组件City.vue中父传子,把cityies传给子组件Search.vue,子组件进行接收数据 监听keyWord,由于这部分经常用到,为了节约性能,用到函数节流,先在data中增加timer:null 初步效果如下
  • 主要为大家详细介绍了vue基于mint-ui实现城市选择三级联动,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
  • 城市选择三级联动 (v,i) in arr" :key="i">{{v.name}} (v,i) in cityArr" :key="i">{{v.name}} (v,i) in districtArr" :key="i">{{v.name}} </select> <script src="../../js/vue.min.js"> ...
  • vue.js城市选择框组件 vue-country-select (vue-country-select) A Vue.js component implementing the select control used to select countries. 一个Vue.js组件,实现用于选择国家/地区的选择控件。 现场演示 ...
  • 估计也是因为不难所以网上才没具体教程的吧效果图.png准备一串Json的数据json数据就是对象格式和数组格式互相嵌套,在这里大家可以下载我这个(其实我也是下载别人的),本教程也是用这个来实现的链接: ...
  • 文章目录Alphabet.vue 子传父City.vue 父传子List.vue watch监听字母表组件进行滚动事件监听 Alphabet.vue 子传父 当点击某个字母时,这个事件方法会接收到一个e的事件对象 子传父 调用this.$emit向外触发事件,...
  • 搜索逻辑实现 根据你输入的字符进行搜索你的城市。 先将搜索栏需要用到的数据先从父组件传过来。 绑定我们的输入框 先把数据设置为空字符串,然后给绑定的keyword进行监听,给他加了个定时器也是为了限流。 基本...
  • vue.js城市选择框组件A Vue.js component implementing the datetime picker control using the Eonasdan's bootstrap datetime picker plugin. 一个Vue.js组件,使用Eonasdan的bootstrap datetime picker插件实现...
  • 项目是基于vue2 的移动端项目,供大家参考,具体内容如下1、实际效果地址三级联动 mint-ui picker.png2、首先你需要去下载一个包含中国省份,城市,区县的数据如下:(这个地址里面包含二级联动数据,三级联动数据,...

空空如也

空空如也

1 2 3 4 5 ... 11
收藏数 204
精华内容 81
关键字:

vue实现城市选择

vue 订阅