Showing
2 changed files
with
13 additions
and
6 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-06 16:01:31 | 4 | + * @LastEditTime: 2024-06-13 17:13:29 |
| 5 | * @FilePath: /data-table/src/components/AreaPickerField/MyComponent.vue | 5 | * @FilePath: /data-table/src/components/AreaPickerField/MyComponent.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -46,10 +46,10 @@ import { useCustomFieldValue } from '@vant/use'; | ... | @@ -46,10 +46,10 @@ import { useCustomFieldValue } from '@vant/use'; |
| 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(""); | 50 | +const city_code = ref(props.component_props.default?.city_code); |
| 51 | const showPicker = ref(false); | 51 | const showPicker = ref(false); |
| 52 | -let fieldValue = ref(props.component_props.default.picker_value); | 52 | +let fieldValue = ref(props.component_props.default?.picker_value); |
| 53 | 53 | ||
| 54 | const onClick = () => { | 54 | const onClick = () => { |
| 55 | if (!props.component_props.readonly) { // 非只读状态下可以点击弹出 | 55 | if (!props.component_props.readonly) { // 非只读状态下可以点击弹出 | ... | ... |
| 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: 2023-03-29 16:18:53 | 4 | + * @LastEditTime: 2024-06-13 17:06:42 |
| 5 | * @FilePath: /data-table/src/components/AreaPickerField/index.vue | 5 | * @FilePath: /data-table/src/components/AreaPickerField/index.vue |
| 6 | * @Description: 省市区选择控件 | 6 | * @Description: 省市区选择控件 |
| 7 | --> | 7 | --> |
| ... | @@ -25,12 +25,19 @@ import MyComponent from './MyComponent.vue'; | ... | @@ -25,12 +25,19 @@ import MyComponent from './MyComponent.vue'; |
| 25 | const props = defineProps({ | 25 | const props = defineProps({ |
| 26 | item: Object, | 26 | item: Object, |
| 27 | }); | 27 | }); |
| 28 | + | ||
| 29 | +if (props.item.component_props.default) { | ||
| 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}`; | ||
| 31 | + 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; | ||
| 33 | +} | ||
| 34 | + | ||
| 28 | // 注入子组件属性 | 35 | // 注入子组件属性 |
| 29 | provide('props', props.item); | 36 | provide('props', props.item); |
| 30 | // 隐藏显示 | 37 | // 隐藏显示 |
| 31 | const HideShow = computed(() => { | 38 | const HideShow = computed(() => { |
| 32 | return !props.item.component_props.disabled | 39 | return !props.item.component_props.disabled |
| 33 | -}) | 40 | +}); |
| 34 | 41 | ||
| 35 | // 规则校验 | 42 | // 规则校验 |
| 36 | const required = props.item.component_props.required; | 43 | const required = props.item.component_props.required; | ... | ... |
-
Please register or login to post a comment