refactor: add define props multiple

This commit is contained in:
Thanaphon Frappet 2024-11-14 17:50:50 +07:00
parent a5988bc3d4
commit b1d08b19ee

View file

@ -3,7 +3,7 @@ import { onMounted, ref, watch } from 'vue';
import { selectFilterOptionRefMod } from 'src/stores/utils';
import { QSelect } from 'quasar';
const model = defineModel<string | Record<string, unknown> | null>();
const model = defineModel<string | string[] | Record<string, unknown> | null>();
const options = ref<Record<string, unknown>[]>([]);
let defaultFilter: (
@ -26,6 +26,7 @@ const props = withDefaults(
incremental?: boolean;
fillInput?: boolean;
disable?: boolean;
multiple?: boolean;
rules?: ((value: string) => string | true)[];
}>(),
@ -75,7 +76,9 @@ watch(
use-input
emit-value
map-options
:hideSelected
:multiple
:use-chips="multiple"
:hide-selected
hide-bottom-space
:fill-input="fillInput && !!model"
:hide-dropdown-icon="readonly"
@ -108,7 +111,6 @@ watch(
</template>
<template v-slot:no-option>
<slot name="noOption"></slot>
<slot name="no-option"></slot>
<q-item v-if="!$slots.noOption">
@ -122,7 +124,6 @@ watch(
v-if="$slots.selectedItem || $slots['selected-item']"
v-slot:selected-item="scope"
>
<slot name="selectedItem" :scope="scope" :opt="scope.opt as T"></slot>
<slot name="selected-item" :scope="scope" :opt="scope.opt as T"></slot>
</template>