chore: 🔨 合并冲突解决
This commit is contained in:
@@ -21,9 +21,7 @@ const props = defineProps({
|
||||
});
|
||||
|
||||
const label = ref("");
|
||||
const tagType = ref<
|
||||
"success" | "warning" | "info" | "primary" | "danger" | undefined
|
||||
>();
|
||||
const tagType = ref<"success" | "warning" | "info" | "primary" | "danger" | undefined>();
|
||||
|
||||
const tagSize = ref(props.size as "default" | "large" | "small");
|
||||
|
||||
@@ -41,18 +39,9 @@ const getLabelAndTagByValue = async (dictCode: string, value: any) => {
|
||||
|
||||
// 监听 props 的变化,获取并更新 label 和 tag
|
||||
const fetchLabelAndTag = async () => {
|
||||
const result = await getLabelAndTagByValue(
|
||||
props.code as string,
|
||||
props.modelValue
|
||||
);
|
||||
const result = await getLabelAndTagByValue(props.code as string, props.modelValue);
|
||||
label.value = result.label;
|
||||
tagType.value = result.tag as
|
||||
| "success"
|
||||
| "warning"
|
||||
| "info"
|
||||
| "primary"
|
||||
| "danger"
|
||||
| undefined;
|
||||
tagType.value = result.tag as "success" | "warning" | "info" | "primary" | "danger" | undefined;
|
||||
};
|
||||
|
||||
// 首次挂载时获取字典数据
|
||||
|
||||
@@ -68,8 +68,7 @@ const props = defineProps({
|
||||
type: {
|
||||
type: String,
|
||||
default: "select",
|
||||
validator: (value: string) =>
|
||||
["select", "radio", "checkbox"].includes(value),
|
||||
validator: (value: string) => ["select", "radio", "checkbox"].includes(value),
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
@@ -120,9 +119,7 @@ watch(
|
||||
(newOptions) => {
|
||||
// options 加载后,确保 selectedValue 可以正确匹配到 options
|
||||
if (newOptions.length > 0 && selectedValue.value !== undefined) {
|
||||
const matchedOption = newOptions.find(
|
||||
(option) => option.value === selectedValue.value
|
||||
);
|
||||
const matchedOption = newOptions.find((option) => option.value === selectedValue.value);
|
||||
if (!matchedOption && props.type !== "checkbox") {
|
||||
// 如果找不到匹配项,清空选中
|
||||
selectedValue.value = "";
|
||||
|
||||
Reference in New Issue
Block a user