hookehuyr

fix 地址选择组件,存在默认值时业务逻辑优化

<!--
* @Date: 2022-08-30 14:32:11
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-06-17 14:46:43
* @LastEditTime: 2024-06-17 14:55:21
* @FilePath: /data-table/src/components/AreaPickerField/index.vue
* @Description: 省市区选择控件
-->
......@@ -27,16 +27,19 @@ const props = defineProps({
item: Object,
});
if (!props.item.component_props.default.city_code) { // 默认值为空
props.item.component_props.default.picker_value = '';
props.item.component_props.default.input_value = '';
props.item.city_code = '';
} else {
props.item.component_props.default.picker_value = `${props.item.component_props.default.province} ${props.item.component_props.default.city} ${props.item.component_props.default.district}`;
props.item.component_props.default.input_value = props.item.component_props.default.street;
props.item.city_code = props.item.component_props.default.city_code;
if (props.item.component_props.default) { // 存在默认值时业务逻辑
if (!props.item.component_props.default?.city_code) { // 默认值为空
props.item.component_props.default.picker_value = '';
props.item.component_props.default.input_value = '';
props.item.city_code = '';
} else {
props.item.component_props.default.picker_value = `${props.item.component_props.default.province} ${props.item.component_props.default.city} ${props.item.component_props.default.district}`;
props.item.component_props.default.input_value = props.item.component_props.default.street;
props.item.city_code = props.item.component_props.default.city_code;
}
}
// 注入子组件属性
provide('props', props.item);
// 隐藏显示
......