小程序省市区字典数据在哪里可以下载,
发布于 6 年前 作者 tao66 15798 次浏览 来自 问答

因业务需要,前台使用picker组件选择地市,后台录入数据的时候,需要对应的地市数据,否则前后台数据不一致,导致部分数据出不来

3 回复

bindRegionChange(e) {

      this.openCity()

      let cityName = e.detail.value[1]

      this.data.cityList.map((item) => {

        if (item.townName === cityName.substring(0, 2)) {

          console.log(item.townId)

          this.setData({

            schoolTownId: item.townId,

            schoolType: ‘HIGH_SCHOOL’,

            schoolName: ‘’,

            changeColor: true

          })

        }

      })

      this.setData({

        region: cityName.substring(0, cityName.length - 1)

      })

    },

    //选择高中后确定

    saveCity() {

      this.setData({

        schoolName: this.data.region + ‘-高中生’,

        isSchool: false

      })

    }

this.dataList是一个接口返回的城市数据,使用townName跟官方的picker的townName匹配。拿到townId即可

恩恩,这个没有问题,我想咨询的是后台的这个数据内容

大佬?现在有这个东西了么?

回到顶部