0
0
Fork 0

refs #6907 feat: merge changes

This commit is contained in:
Javier Segarra 2024-03-21 12:33:28 +01:00
parent f5d6c45339
commit 18d4be0ea2
1 changed files with 8 additions and 4 deletions

View File

@ -26,7 +26,7 @@ const value = computed({
emit('update:modelValue', value); emit('update:modelValue', value);
}, },
}); });
const focus = ref(false); const hover = ref(false);
const styleAttrs = computed(() => { const styleAttrs = computed(() => {
return $props.isOutlined return $props.isOutlined
? { ? {
@ -45,6 +45,10 @@ const handleValue = (val = null) => {
value.value = val; value.value = val;
}; };
const focus = () => {
vnInputRef.value.focus();
};
defineExpose({ defineExpose({
focus, focus,
}); });
@ -52,8 +56,8 @@ defineExpose({
<template> <template>
<div <div
@mouseover="focus = true" @mouseover="hover = true"
@mouseleave="focus = false" @mouseleave="hover = false"
:rules="$attrs.required ? [requiredFieldRule] : null" :rules="$attrs.required ? [requiredFieldRule] : null"
> >
<QInput <QInput
@ -74,7 +78,7 @@ defineExpose({
<QIcon <QIcon
name="close" name="close"
size="xs" size="xs"
v-if="focus && value" v-if="hover && value"
@click="handleValue(null)" @click="handleValue(null)"
></QIcon> ></QIcon>
</template> </template>