refs #6907 feat: fix_input_clearable_hover
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2024-02-21 09:19:06 +01:00
parent a3ad94e2b5
commit 1e7c8e03df
2 changed files with 28 additions and 17 deletions

View File

@ -1,5 +1,5 @@
<script setup>
import { computed } from 'vue';
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
const emit = defineEmits(['update:modelValue', 'update:options', 'keyup.enter']);
@ -26,7 +26,7 @@ const value = computed({
emit('update:modelValue', value);
},
});
const focus = ref(false);
const styleAttrs = computed(() => {
return $props.isOutlined
? {
@ -43,20 +43,32 @@ const onEnterPress = () => {
</script>
<template>
<QInput
ref="vnInputRef"
v-model="value"
v-bind="{ ...$attrs, ...styleAttrs }"
type="text"
:class="{ required: $attrs.required }"
@keyup.enter="onEnterPress()"
<div
@mouseover="focus = true"
@mouseleave="focus = false"
:rules="$attrs.required ? [requiredFieldRule] : null"
>
<template v-if="$slots.prepend" #prepend>
<slot name="prepend" />
</template>
<template v-if="$slots.append" #append>
<slot name="append" />
</template>
</QInput>
<QInput
ref="vnInputRef"
v-model="value"
v-bind="{ ...$attrs, ...styleAttrs }"
type="text"
:class="{ required: $attrs.required }"
@keyup.enter="onEnterPress()"
>
<template v-if="$slots.prepend" #prepend>
<slot name="prepend" />
</template>
<template #append>
<slot name="append" v-if="$slots.append" />
<QIcon
name="close"
size="xs"
v-if="focus && value"
@click="value = null"
></QIcon>
</template>
</QInput>
</div>
</template>

View File

@ -69,7 +69,6 @@ const filterOptions = {
v-model="data.socialName"
:label="t('customer.basicData.socialName')"
:rules="validate('client.socialName')"
autofocus
/>
</div>
<div class="col">