refactor: add define props multiple
This commit is contained in:
parent
a5988bc3d4
commit
b1d08b19ee
1 changed files with 5 additions and 4 deletions
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue