如何做一个省市联动下拉选项?开关后台工具栏
curd生成器生成的页面
<FormItem :label="t('user.customer.province')" type="remoteSelect" v-model="baTable.form.items!.province" prop="province" :input-attr="{ pk: 'province_name', field: 'province_name', 'remote-url': '/admin/Province/getAll', cleanXss: provinceEdit}" :placeholder="t('Please select field', { field: t('user.customer.province') })"/> <FormItem :label="t('user.customer.city')" type="select" v-model="baTable.form.items!.city" prop="city" :data="{ content: cityList }" :placeholder="t('Please select field', { field: t('user.customer.city') })" />
var cityList = {} const provinceEdit = () => { console.log(cityList) const this_cityList: { [key: string]: string } = {} var province = baTable.form.items!.province createAxios({ url: '/admin/City/getAll?province=' + province },{showCodeMessage:true}).then((res) => { baTable.form.items!.city = '' each(res.data.list, (item) => { this_cityList[item.city_name] = item.city_name }) cityList = this_cityList console.log(cityList) }) }
在修改cityList成功之后,下拉选项没有任何改变,请问如何解决?
城市省份的数据在模块市场有
模块市场有
模块市场有
- 1
前往