forked from quasarframework/quasar
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(QSelect): dialog - add close icon; add class and style; open whe…
…n typing in field; fix focus on field quasarframework#6523, quasarframework#6858
- Loading branch information
Showing
8 changed files
with
567 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<template> | ||
<div class="q-pa-md"> | ||
<div class="q-gutter-md row"> | ||
<q-select | ||
filled | ||
v-model="model" | ||
label="Default close icon" | ||
:options="options" | ||
style="width: 250px" | ||
behavior="dialog" | ||
dialog-close-icon | ||
> | ||
<template v-slot:no-option> | ||
<q-item> | ||
<q-item-section class="text-grey"> | ||
No results | ||
</q-item-section> | ||
</q-item> | ||
</template> | ||
</q-select> | ||
|
||
<q-select | ||
filled | ||
v-model="model" | ||
use-input | ||
input-debounce="0" | ||
label="Filter with default close icon" | ||
:options="options" | ||
@filter="filterFn" | ||
style="width: 250px" | ||
behavior="dialog" | ||
dialog-close-icon | ||
> | ||
<template v-slot:no-option> | ||
<q-item> | ||
<q-item-section class="text-grey"> | ||
No results | ||
</q-item-section> | ||
</q-item> | ||
</template> | ||
</q-select> | ||
|
||
<q-select | ||
filled | ||
v-model="model" | ||
label="Custom close icon" | ||
:options="options" | ||
style="width: 250px" | ||
behavior="dialog" | ||
dialog-close-icon="close" | ||
> | ||
<template v-slot:no-option> | ||
<q-item> | ||
<q-item-section class="text-grey"> | ||
No results | ||
</q-item-section> | ||
</q-item> | ||
</template> | ||
</q-select> | ||
|
||
<q-select | ||
filled | ||
v-model="model" | ||
use-input | ||
input-debounce="0" | ||
label="Filter with custom close icon" | ||
:options="options" | ||
@filter="filterFn" | ||
style="width: 250px" | ||
behavior="dialog" | ||
dialog-close-icon="close" | ||
> | ||
<template v-slot:no-option> | ||
<q-item> | ||
<q-item-section class="text-grey"> | ||
No results | ||
</q-item-section> | ||
</q-item> | ||
</template> | ||
</q-select> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
const stringOptions = [ | ||
'Google', 'Facebook', 'Twitter', 'Apple', 'Oracle' | ||
] | ||
export default { | ||
data () { | ||
return { | ||
model: null, | ||
stringOptions, | ||
options: stringOptions | ||
} | ||
}, | ||
methods: { | ||
filterFn (val, update) { | ||
if (val === '') { | ||
update(() => { | ||
this.options = stringOptions | ||
}) | ||
return | ||
} | ||
update(() => { | ||
const needle = val.toLowerCase() | ||
this.options = stringOptions.filter(v => v.toLowerCase().indexOf(needle) > -1) | ||
}) | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.