From ee46a4cfd5743796ce73d55af0668b64d16c5a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B1=E7=9C=A0=E5=84=80=E5=BC=8F?= <854085467@qq.com> Date: Fri, 6 May 2022 22:43:50 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D:=20=E6=9B=B4=E6=96=B0=20input=20?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package/component/src/component/input/index.vue | 15 ++++++++------- .../src/component/inputNumber/index.vue | 2 +- .../src/document/zh-CN/components/input.md | 16 +++++++++------- 3 files changed, 18 insertions(+), 15 deletions(-) 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