feat(design,tdesign-vue-next-adapter): input添加click事件

This commit is contained in:
roymondchen 2025-11-10 16:01:20 +08:00
parent 489d321677
commit a96ca8092c
2 changed files with 13 additions and 2 deletions

View File

@ -9,6 +9,7 @@
@update:modelValue="updateModelValue"
@blur="blurHandler"
@focus="focusHandler"
@click="clickHandler"
>
<template #prepend v-if="$slots.prepend">
<slot name="prepend"></slot>
@ -43,7 +44,7 @@ const uiComponent = ui?.component || 'el-input';
const uiProps = computed<InputProps>(() => ui?.props(props) || props);
const emit = defineEmits(['change', 'input', 'blur', 'focus', 'update:modelValue']);
const emit = defineEmits(['change', 'input', 'blur', 'focus', 'click', 'update:modelValue']);
const instance = ref<any>();
@ -67,6 +68,10 @@ const focusHandler = (...args: any[]) => {
emit('focus', ...args);
};
const clickHandler = (...args: any[]) => {
emit('click', ...args);
};
defineExpose({
instance,
getInput() {

View File

@ -12,6 +12,7 @@
@change="changeHandler"
@blur="blurHandler"
@focus="focusHandler"
@click="clickHandler"
@update:modelValue="updateModelValue"
></TTextarea>
<TInputAdornment v-else>
@ -31,6 +32,7 @@
@change="changeHandler"
@blur="blurHandler"
@focus="focusHandler"
@click="clickHandler"
@update:modelValue="updateModelValue"
>
<template #prefix-icon v-if="$slots.prefix">
@ -59,7 +61,7 @@ const props = defineProps<
}
>();
const emit = defineEmits(['change', 'input', 'blur', 'focus', 'update:modelValue']);
const emit = defineEmits(['change', 'input', 'blur', 'focus', 'click', 'update:modelValue']);
const textareaRef = useTemplateRef('textarea');
@ -92,6 +94,10 @@ const focusHandler = (...args: any[]) => {
emit('focus', ...args);
};
const clickHandler = (...args: any[]) => {
emit('click', ...args);
};
const updateModelValue = (...args: any[]) => {
emit('update:modelValue', ...args);
};