hookehuyr

fix 地址组件处理默认值显示问题

<!--
* @Date: 2023-03-29 15:27:02
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-06-06 16:01:31
* @LastEditTime: 2024-06-13 17:13:29
* @FilePath: /data-table/src/components/AreaPickerField/MyComponent.vue
* @Description: 文件描述
-->
......@@ -46,10 +46,10 @@ import { useCustomFieldValue } from '@vant/use';
const props = inject('props');
const show_address = ref(!props.component_props.no_street)
const address = ref(props.component_props.default.input_value);
const city_code = ref("");
const address = ref(props.component_props.default?.input_value);
const city_code = ref(props.component_props.default?.city_code);
const showPicker = ref(false);
let fieldValue = ref(props.component_props.default.picker_value);
let fieldValue = ref(props.component_props.default?.picker_value);
const onClick = () => {
if (!props.component_props.readonly) { // 非只读状态下可以点击弹出
......
<!--
* @Date: 2022-08-30 14:32:11
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-03-29 16:18:53
* @LastEditTime: 2024-06-13 17:06:42
* @FilePath: /data-table/src/components/AreaPickerField/index.vue
* @Description: 省市区选择控件
-->
......@@ -25,12 +25,19 @@ import MyComponent from './MyComponent.vue';
const props = defineProps({
item: Object,
});
if (props.item.component_props.default) {
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);
// 隐藏显示
const HideShow = computed(() => {
return !props.item.component_props.disabled
})
});
// 规则校验
const required = props.item.component_props.required;
......