hookehuyr

地址选择器默认值和可读显示

<!--
* @Date: 2023-03-29 15:27:02
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-06-06 16:01:31
* @FilePath: /data-table/src/components/AreaPickerField/MyComponent.vue
* @Description: 文件描述
-->
<template>
<div style="width: 100%;">
<van-field
......@@ -6,7 +13,7 @@
readonly
:required="props.component_props.required"
placeholder="请选择省市区"
@click="showPicker = true"
@click="onClick"
:border="show_address ? true : false"
/>
<van-field
......@@ -14,6 +21,7 @@
v-model="address"
placeholder="请填写详细地址"
:border="false"
:readonly="props.component_props.readonly"
/>
<van-divider />
......@@ -38,10 +46,17 @@ import { useCustomFieldValue } from '@vant/use';
const props = inject('props');
const show_address = ref(!props.component_props.no_street)
const address = ref("");
const address = ref(props.component_props.default.input_value);
const city_code = ref("");
const showPicker = ref(false);
let fieldValue = ref("");
let fieldValue = ref(props.component_props.default.picker_value);
const onClick = () => {
if (!props.component_props.readonly) { // 非只读状态下可以点击弹出
showPicker.value = true;
}
};
const result_value = computed(() => {
return {
address: fieldValue.value + ' ' + address.value,
......