Showing
2 changed files
with
10 additions
and
4 deletions
| 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-17 14:47:21 | 4 | + * @LastEditTime: 2024-07-06 22:53:13 |
| 5 | * @FilePath: /data-table/src/components/AreaPickerField/MyComponent.vue | 5 | * @FilePath: /data-table/src/components/AreaPickerField/MyComponent.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -44,7 +44,7 @@ import { useCustomFieldValue } from '@vant/use'; | ... | @@ -44,7 +44,7 @@ import { useCustomFieldValue } from '@vant/use'; |
| 44 | 44 | ||
| 45 | // 获取父组件传值 | 45 | // 获取父组件传值 |
| 46 | const props = inject('props'); | 46 | const props = inject('props'); |
| 47 | -const show_address = ref(!props.component_props.no_street) | 47 | +const show_address = ref(!props.component_props.no_street); |
| 48 | 48 | ||
| 49 | const address = ref(props.component_props.default?.input_value); | 49 | const address = ref(props.component_props.default?.input_value); |
| 50 | const city_code = ref(props.component_props.default?.city_code); | 50 | const city_code = ref(props.component_props.default?.city_code); |
| ... | @@ -62,7 +62,7 @@ const result_value = computed(() => { | ... | @@ -62,7 +62,7 @@ const result_value = computed(() => { |
| 62 | address: fieldValue.value + ' ' + address.value, | 62 | address: fieldValue.value + ' ' + address.value, |
| 63 | city_code: city_code.value, | 63 | city_code: city_code.value, |
| 64 | picker_value: fieldValue.value, | 64 | picker_value: fieldValue.value, |
| 65 | - input_value: address.value | 65 | + input_value: address.value, |
| 66 | } | 66 | } |
| 67 | }) | 67 | }) |
| 68 | 68 | ... | ... |
| 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-17 14:55:21 | 4 | + * @LastEditTime: 2024-07-06 22:51:15 |
| 5 | * @FilePath: /data-table/src/components/AreaPickerField/index.vue | 5 | * @FilePath: /data-table/src/components/AreaPickerField/index.vue |
| 6 | * @Description: 省市区选择控件 | 6 | * @Description: 省市区选择控件 |
| 7 | --> | 7 | --> |
| ... | @@ -37,6 +37,12 @@ if (props.item.component_props.default) { // 存在默认值时业务逻辑 | ... | @@ -37,6 +37,12 @@ if (props.item.component_props.default) { // 存在默认值时业务逻辑 |
| 37 | props.item.component_props.default.input_value = props.item.component_props.default.street; | 37 | props.item.component_props.default.input_value = props.item.component_props.default.street; |
| 38 | props.item.city_code = props.item.component_props.default.city_code; | 38 | props.item.city_code = props.item.component_props.default.city_code; |
| 39 | } | 39 | } |
| 40 | +} else { // 默认值为空, 处理数据显示问题 - 详细地址不填写可能存在undefined | ||
| 41 | + props.item.component_props.default = { | ||
| 42 | + picker_value: '', | ||
| 43 | + input_value: '', | ||
| 44 | + city_code: '', | ||
| 45 | + } | ||
| 40 | } | 46 | } |
| 41 | 47 | ||
| 42 | 48 | ... | ... |
-
Please register or login to post a comment