hookehuyr

fix 处理地址选择组件默认值为空时显示问题

1 <!-- 1 <!--
2 * @Date: 2023-03-29 15:27:02 2 * @Date: 2023-03-29 15:27:02
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-06-13 17:13:29 4 + * @LastEditTime: 2024-06-17 14:47:21
5 * @FilePath: /data-table/src/components/AreaPickerField/MyComponent.vue 5 * @FilePath: /data-table/src/components/AreaPickerField/MyComponent.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
......
1 <!-- 1 <!--
2 * @Date: 2022-08-30 14:32:11 2 * @Date: 2022-08-30 14:32:11
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-06-13 17:06:42 4 + * @LastEditTime: 2024-06-17 14:46:43
5 * @FilePath: /data-table/src/components/AreaPickerField/index.vue 5 * @FilePath: /data-table/src/components/AreaPickerField/index.vue
6 * @Description: 省市区选择控件 6 * @Description: 省市区选择控件
7 --> 7 -->
...@@ -21,12 +21,17 @@ ...@@ -21,12 +21,17 @@
21 21
22 <script setup> 22 <script setup>
23 import MyComponent from './MyComponent.vue'; 23 import MyComponent from './MyComponent.vue';
24 +import _ from 'lodash'
24 25
25 const props = defineProps({ 26 const props = defineProps({
26 item: Object, 27 item: Object,
27 }); 28 });
28 29
29 -if (props.item.component_props.default) { 30 +if (!props.item.component_props.default.city_code) { // 默认值为空
31 + props.item.component_props.default.picker_value = '';
32 + props.item.component_props.default.input_value = '';
33 + props.item.city_code = '';
34 +} else {
30 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}`; 35 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}`;
31 props.item.component_props.default.input_value = props.item.component_props.default.street; 36 props.item.component_props.default.input_value = props.item.component_props.default.street;
32 props.item.city_code = props.item.component_props.default.city_code; 37 props.item.city_code = props.item.component_props.default.city_code;
......