citylist.vue 764 B

123456789101112131415161718192021222324252627282930313233343536
  1. <template>
  2. <view>
  3. <van-index-bar>
  4. <loading v-if="loading" />
  5. <view v-for="(item,index) in cityList" :key='index'>
  6. <van-index-anchor :index="index" />
  7. <van-cell @click='selectCity(sonitem)' :title="sonitem.regionName" v-for="(sonitem,sonindex) in item" :key='sonindex' />
  8. </view>
  9. </van-index-bar>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. data: () => ({
  15. cityList: [],
  16. loading: true
  17. }),
  18. onLoad: async function(option) {
  19. let data = await this.goPageGetData()
  20. this.cityList = data.cityList
  21. this.loading = false
  22. },
  23. methods: {
  24. selectCity(obj) {
  25. this.$store.commit('SET_CITYOBJ', obj)
  26. this.$store.commit('SET_CITYID', obj.cityId)
  27. uni.navigateBack()
  28. }
  29. }
  30. }
  31. </script>
  32. <style lang="scss">
  33. </style>