Closed Biiddd closed 4 months ago
定义接口
import { RegionInputModel } from 'v-region'; interface FullUserInfo { user_id: string; region: RegionInputModel; detailAdd: string; } const thisFullUserInfo = ref<FullUserInfo>({ user_id: '', region:<RegionInputModel>{ province: '', city: '', area: '', town: '' }, detailAdd: '', });
如果这样thisFullInfo.value = res.data赋值会导致<RegionText v-model="thisFullUserInfo.region" />无法显示地址
thisFullInfo.value = res.data
<RegionText v-model="thisFullUserInfo.region" />
必须单独赋值给region对象thisFullUserInfo.value.region = res.data.region才能获得纯文本地址
thisFullUserInfo.value.region = res.data.region
可以考虑设置一个 computed 单独将 region 部分引用出来,再与插件绑定
定义接口
如果这样
thisFullInfo.value = res.data
赋值会导致<RegionText v-model="thisFullUserInfo.region" />
无法显示地址必须单独赋值给region对象
thisFullUserInfo.value.region = res.data.region
才能获得纯文本地址