You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
high-mini/qianzhu-Starbucks/changeRegin/changeRegin.vue

117 lines
2.5 KiB

<template>
<view>
<city-select @cityClick="cityClick" :formatName="formatName" :activeCity="activeCity" :hotCity="hotCity"
:obtainCitys="obtainCitys" :isSearch="true" ref="citys"></city-select>
</view>
</template>
<script>
import citySelect from '@/components/city-select/city-select.vue'
export default {
data() {
return {
//需要构建索引参数的名称(注意:传递的对象里面必须要有这个名称的参数)
formatName: 'cityName',
//当前城市
activeCity: {
id: 1,
cityName: '南京市'
},
//热门城市
hotCity: [{
id: 0,
cityName: '南京市'
},
{
id: 1,
cityName: '南京市'
}
],
//显示的城市数据
obtainCitys: [{
"cityInitial": "N",
"cityName": "内江市",
"provinceCode": "510000",
"cityCode": "511000000000",
"provinceName": "四川省",
"cityId": 528
},
{
"cityInitial": "L",
"cityName": "乐山市",
"provinceCode": "510000",
"cityCode": "511100000000",
"provinceName": "四川省",
"cityId": 141
},
{
"cityInitial": "N",
"cityName": "南充市",
"provinceCode": "510000",
"cityCode": "511300000000",
"provinceName": "四川省",
"cityId": 130
},
{
"cityInitial": "M",
"cityName": "眉山市",
"provinceCode": "510000",
"cityCode": "511400000000",
"provinceName": "四川省",
"cityId": 228
},
{
"cityInitial": "Y",
"cityName": "宜宾市",
"provinceCode": "510000",
"cityCode": "511500000000",
"provinceName": "四川省",
"cityId": 144
},
{
"cityInitial": "G",
"cityName": "广安市",
"provinceCode": "510000",
"cityCode": "511600000000",
"provinceName": "四川省",
"cityId": 5
}
]
}
},
components: {
citySelect
},
onLoad() {
this.activeCity = {
id: 1,
cityName: '南京市',
cityCode: 110100
}
//热门城市
this.hotCity = [{
id: 0,
cityName: '南京市',
cityCode: 110100
},
{
id: 1,
cityName: '北京市',
cityCode: 110102
}
]
},
methods: {
cityClick(item) {
uni.showToast({
icon: 'none',
title: 'item: ' + JSON.stringify(item),
duration: 2000
})
}
}
}
</script>
<style></style>