diff --git a/package/component/src/component/input/index.vue b/package/component/src/component/input/index.vue index a8523e21..2c5f888c 100644 --- a/package/component/src/component/input/index.vue +++ b/package/component/src/component/input/index.vue @@ -42,9 +42,10 @@ const emit = defineEmits([ "blur", ]); -const onInput = function (event: InputEvent) { +const onInput = function (event: Event) { const inputElement = event.target as HTMLInputElement; - emit("update:modelValue", inputElement.value); + const value = inputElement.value; + emit("update:modelValue", value); emit("input", event); }; @@ -52,16 +53,16 @@ const onClear = () => { emit("update:modelValue", ""); }; -const onFocus = (event: FocusEvent) => { +const onFocus = (event: Event) => { emit("focus", event); }; -const onChange = () => { - emit("change"); +const onChange = (event: Event) => { + emit("change", event); }; -const onBlur = () => { - emit("blur"); +const onBlur = (event: Event) => { + emit("blur", event); }; diff --git a/package/component/src/component/inputNumber/index.vue b/package/component/src/component/inputNumber/index.vue index 698e5ff3..ff57c9e7 100644 --- a/package/component/src/component/inputNumber/index.vue +++ b/package/component/src/component/inputNumber/index.vue @@ -142,4 +142,4 @@ const isNumber = function (num: any) { /> - \ No newline at end of file + diff --git a/package/document/src/document/zh-CN/components/input.md b/package/document/src/document/zh-CN/components/input.md index 00e85cda..a8e82c79 100644 --- a/package/document/src/document/zh-CN/components/input.md +++ b/package/document/src/document/zh-CN/components/input.md @@ -13,6 +13,7 @@ ::: demo 使用 `lay-input` 标签, 创建输入框 @@ -175,6 +176,7 @@ export default { | name | 原始属性 name | -- | | placeholder | 提示信息 | -- | | disabled | 禁用 | `true` `false` | +| readonly | 原生属性 readonly | `true` `false` | | v-model | 值 | -- | | autofocus | 原生属性 autofocus | `true` `false` | | autocomplete | 原生属性 autocomplete | `true` `false` | @@ -186,15 +188,15 @@ export default { ::: table -| 事件 | 描述 | 参数 | -| ----- | --------------- | ---------------- | -| input | 原生 input 事件 | event : 事件对象 | -| foucs | 原生 foucs 事件 | event : 事件对象 | -| blur | 原生 blur 事件 | -- | +| 事件 | 描述 | 参数 | +| ----- | ------------------- | ----------------| +| input | 原生 input 事件 | event : Event | +| foucs | 原生 foucs 事件 | event : Event | +| blur | 原生 blur 事件 | event : Event | +| change| 原生 change 事件 | event : Event | +| clear | 清空 事件 | -- | ::: - - ::: previousNext input ::: \ No newline at end of file