chore: remote-select mode还原回原来的模式

This commit is contained in:
xiaojunnuo
2026-03-17 13:54:02 +08:00
parent 12700e1754
commit c66e5f9fcd
2 changed files with 18 additions and 15 deletions
@@ -54,13 +54,11 @@ export function createRemoteSelectInputDefine(opts?: {
const helper = opts?.helper || "请选择"; const helper = opts?.helper || "请选择";
const search = opts?.search ?? false; const search = opts?.search ?? false;
const pager = opts?.pager ?? false; const pager = opts?.pager ?? false;
let mode = "tags"; let mode = "default";
if (opts.multi === false) { const multi = opts?.multi ?? true;
mode = undefined; if (multi) {
} else { mode = "tags";
mode = opts?.mode ?? "tags";
} }
const item = { const item = {
title, title,
component: { component: {
@@ -72,6 +70,7 @@ export function createRemoteSelectInputDefine(opts?: {
action, action,
search, search,
pager, pager,
multi,
watches: [certDomainsInputKey, accessIdInputKey, ...watches], watches: [certDomainsInputKey, accessIdInputKey, ...watches],
...opts.component, ...opts.component,
}, },
@@ -1,7 +1,7 @@
<template> <template>
<div class="remote-select"> <div class="remote-select">
<div class="flex flex-row"> <div class="flex flex-row">
<a-select class="remote-select-input" show-search mode="tags" :filter-option="filterOption" :options="optionsRef" :value="value" v-bind="attrs" @click="onClick" @update:value="updateValue($event)"> <a-select ref="selectRef" class="remote-select-input" show-search :filter-option="filterOption" :options="optionsRef" :value="value" v-bind="attrs" @click="onClick" @update:value="updateValue($event)">
<template #dropdownRender="{ menuNode: menu }"> <template #dropdownRender="{ menuNode: menu }">
<template v-if="search"> <template v-if="search">
<div class="flex w-full" style="padding: 4px 8px"> <div class="flex w-full" style="padding: 4px 8px">
@@ -44,6 +44,8 @@ defineOptions({
name: "RemoteSelect", name: "RemoteSelect",
}); });
const selectRef = ref(null);
const VNodes = defineComponent({ const VNodes = defineComponent({
props: { props: {
vnodes: { vnodes: {
@@ -61,7 +63,7 @@ const props = defineProps<
watches?: string[]; watches?: string[];
search?: boolean; search?: boolean;
pager?: boolean; pager?: boolean;
mode?: string; multi?: boolean;
} & ComponentPropsType } & ComponentPropsType
>(); >();
@@ -70,13 +72,15 @@ const emit = defineEmits<{
}>(); }>();
function updateValue(value: any) { function updateValue(value: any) {
debugger; // if (props.multi !== false) {
if (props.mode === "tags" || props.mode === "multiple") { // emit("update:value", value);
emit("update:value", value); // } else {
} else { // const last = value?.[value.length - 1];
const last = value?.[value.length - 1]; // emit("update:value", last);
emit("update:value", last); // selectRef.value.blur();
} // }
emit("update:value", value);
} }
const attrs = useAttrs(); const attrs = useAttrs();