TerryZ / v-region

提供 5 种应用形式的 4 级行政区划选择器 A simple region cascade selector, provide 4 levels Chinese administrative division data
https://terryz.github.io/docs-vue3/cn/region/
MIT License
915 stars 148 forks source link

RegionText不能正确显示 #68

Closed Biiddd closed 4 months ago

Biiddd commented 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" />无法显示地址

必须单独赋值给region对象thisFullUserInfo.value.region = res.data.region才能获得纯文本地址

TerryZ commented 4 months ago

可以考虑设置一个 computed 单独将 region 部分引用出来,再与插件绑定