fix: 合并github分支问题修复

Former-commit-id: 27699dcc21018068659432531e9992c9a4e18271
This commit is contained in:
hxr
2023-08-07 23:58:21 +08:00
6 changed files with 28 additions and 6 deletions

View File

@@ -5,6 +5,7 @@
:placeholder="placeholder"
:disabled="disabled"
clearable
@change="handleChange"
>
<el-option
v-for="option in options"
@@ -20,6 +21,9 @@
import { getDictOptions } from "@/api/dict";
const props = defineProps({
/**
* 字典类型编码(eg: 性别-gender)
*/
typeCode: {
type: String,
required: true,
@@ -38,11 +42,15 @@ const props = defineProps({
},
});
const emits = defineEmits(["update:modelValue"]);
const emits = defineEmits(["update:modelValue"]); // 父组件监听事件,同步子组件值的变化给父组件
const selectedValue = useVModel(props, "modelValue", emits);
const options: Ref<OptionType[]> = ref([]); // 字典下拉数据源
const options: Ref<OptionType[]> = ref([]);
const selectedValue = computed(() => props.modelValue.toString()); // 将父组件的值统一转化String和下拉数据源进行比较避免值的类型不一致导致回显失败
function handleChange(val?: string) {
emits("update:modelValue", val);
}
onBeforeMount(() => {
// 根据字典类型编码(typeCode)获取字典选项