mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-28 19:00:35 +01:00
feat(InputMenu): handle nullable prop when clearing input
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
:name="name"
|
:name="name"
|
||||||
:model-value="modelValue"
|
:model-value="modelValue"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
|
:nullable="nullable"
|
||||||
as="div"
|
as="div"
|
||||||
:class="ui.wrapper"
|
:class="ui.wrapper"
|
||||||
@update:model-value="onUpdate"
|
@update:model-value="onUpdate"
|
||||||
@@ -194,6 +195,10 @@ export default defineComponent({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
nullable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
placeholder: {
|
placeholder: {
|
||||||
type: String,
|
type: String,
|
||||||
default: null
|
default: null
|
||||||
@@ -294,6 +299,10 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const label = computed(() => {
|
const label = computed(() => {
|
||||||
|
if (!props.modelValue) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (props.valueAttribute) {
|
if (props.valueAttribute) {
|
||||||
const option = props.options.find(option => option[props.valueAttribute] === props.modelValue)
|
const option = props.options.find(option => option[props.valueAttribute] === props.modelValue)
|
||||||
return option ? option[props.optionAttribute] : null
|
return option ? option[props.optionAttribute] : null
|
||||||
|
|||||||
Reference in New Issue
Block a user