Files
newfreeplanet_OLD/src/components/CMySelect/CMySelect.vue

104 lines
2.7 KiB
Vue
Raw Normal View History

2021-09-16 21:08:02 +02:00
<template>
<div class="text-center">
<div v-if="useinput">
<q-select
:multiple="multiple"
rounded
outlined
2021-12-17 18:30:18 +01:00
v-bind="$attrs"
2021-09-16 21:08:02 +02:00
:input-class="myclass"
:model-value="myvalue"
2021-09-16 21:08:02 +02:00
:use-input="useinput"
input-debounce="0"
@new-value="newvaluefunc"
new-value-mode="add-unique"
2021-12-11 00:25:35 +01:00
:options="valori"
2021-09-16 21:08:02 +02:00
:option-value="optval"
:option-label="optlab"
@update:model-value="changeval"
2021-09-16 21:08:02 +02:00
:label="label"
:dense="dense">
2021-09-16 21:08:02 +02:00
</q-select>
</div>
<div v-else>
<q-select
v-if="pickup"
filled
:model-value="myvalue"
clearable
use-input
hide-selected
fill-input
input-debounce="300"
:dense="dense"
:input-class="myclass"
:options="valori"
:option-value="optval"
:option-label="optlab"
map-options
@filter="filterFn"
@update:model-value="changeval"
:label="label"
options-selected-class="text-deep-orange"
v-bind="$attrs"
style="width: 250px"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
No results
</q-item-section>
</q-item>
</template>
<template v-slot:option="scope">
<q-item v-bind="scope.itemProps">
<q-item-section avatar>
{{ scope.opt.flag }}
</q-item-section>
<q-item-section>
<q-item-label> {{ scope.opt.value }}</q-item-label>
</q-item-section>
</q-item>
</template>
</q-select>
<q-select
v-else
2021-09-16 21:08:02 +02:00
:multiple="multiple"
rounded
outlined
:dense="dense"
:input-class="myclass"
:model-value="myvalue"
2021-12-11 00:25:35 +01:00
:options="valori"
2021-09-16 21:08:02 +02:00
:option-value="optval"
:option-label="optlab"
@update:model-value="changeval"
2021-09-16 21:08:02 +02:00
:label="label"
emit-value
2021-12-17 18:30:18 +01:00
options-selected-class="text-deep-orange"
2021-09-16 21:08:02 +02:00
map-options
2021-12-17 18:30:18 +01:00
v-bind="$attrs"
style="min-width: 170px; max-width: 400px;">
2021-12-17 18:30:18 +01:00
<template v-slot:option="scope">
<q-item v-bind="scope.itemProps">
<q-item-section avatar>
<q-icon :name="scope.opt.icon ? scope.opt.icon : ''"/>
</q-item-section>
<q-item-section>
<q-item-label>{{ scope.opt.descr }}</q-item-label>
</q-item-section>
</q-item>
</template>
2021-09-16 21:08:02 +02:00
</q-select>
</div>
</div>
</template>
<script lang="ts" src="./CMySelect.ts">
</script>
<style lang="scss" scoped>
@import './CMySelect.scss';
</style>