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