From 8514d1b282df903061ddd612c15adf969c422cdf Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周日, 04 5月 2025 10:17:07 +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