From 9bec4dcae002f36aa23231da11cb03a156b40110 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周三, 30 4月 2025 16:24:16 +0800 Subject: [PATCH] 222 --- PipeLineLems/web/src/components/BaseInput/BaseInput.tsx | 29 +++++++++++++++++++++++++++-- 1 files changed, 27 insertions(+), 2 deletions(-) diff --git a/PipeLineLems/web/src/components/BaseInput/BaseInput.tsx b/PipeLineLems/web/src/components/BaseInput/BaseInput.tsx index 6747f1a..d3dda5a 100644 --- a/PipeLineLems/web/src/components/BaseInput/BaseInput.tsx +++ b/PipeLineLems/web/src/components/BaseInput/BaseInput.tsx @@ -1,9 +1,10 @@ import { defineComponent, SetupContext, ref, computed } from 'vue' import styles from './BaseInput.module.scss' +import { getScopeT, Language } from '@/libs/Language/Language' export default defineComponent({ name: 'BaseInput', - emits: ['update:modelValue', 'click'], + emits: ['update:modelValue', 'click', 'change', 'enter'], props: { modelValue: { type: [String, Number], @@ -13,8 +14,24 @@ type: String, default: '璇疯緭鍏�', }, + readOnly: { + type: Boolean, + default: false, + }, + LanguageScopeKey: { + type: String, + default: '', + }, + onChange: { + type: Function, + }, + onEnter: { + type: Function, + }, }, setup(props, { attrs, slots, emit }: SetupContext) { + const _t = getScopeT(props.LanguageScopeKey) + const input = computed({ get() { return props.modelValue @@ -27,16 +44,24 @@ evt?.stopPropagation() emit('click', evt) } + const onKeypress = (event: KeyboardEvent) => { + if (event.keyCode === 13) { + emit('enter') + } + } return () => { return ( <div class={styles.baseInput} onClick={onClick}> <input - placeholder={props.placeholder} + {...attrs} + placeholder={_t(props.placeholder)} class={{ [styles.input]: true, [styles.hover]: true, }} v-model={input.value} + onInput={() => emit('change')} + onKeypress={onKeypress} /> {/* <span class={styles.hasHover}> {input.value ? ( -- Gitblit v1.9.3