From a239dc490cd4ba0d8dee6b8253073c10c67e6e4d Mon Sep 17 00:00:00 2001 From: Marvin Gui <63292605+yi-boide@users.noreply.github.com> Date: Thu, 9 Nov 2023 17:59:06 +0800 Subject: [PATCH] =?UTF-8?q?feat(input):=20modelValue=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=20number=20=E7=B1=BB=E5=9E=8B=20(#2635)=20(#2638)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages/__VUE/input/doc.en-US.md | 2 +- src/packages/__VUE/input/doc.md | 2 +- src/packages/__VUE/input/doc.taro.md | 2 +- src/packages/__VUE/input/index.taro.vue | 9 +++++---- src/packages/__VUE/input/index.vue | 9 +++++---- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/packages/__VUE/input/doc.en-US.md b/src/packages/__VUE/input/doc.en-US.md index 4c98022b94..a68ae10cbd 100644 --- a/src/packages/__VUE/input/doc.en-US.md +++ b/src/packages/__VUE/input/doc.en-US.md @@ -252,7 +252,7 @@ const val = ref(''); | Attribute | Description | Type | Default | | --- | --- | --- | --- | -| v-model | Input value, two-way binding | string | - | +| v-model | Input value, two-way binding | string \| number | - | | type | Input type, support all native types and `number` `digit` type | string | `text` | | placeholder | Placeholder when the input box is empty | string | - | | input-align | Input align, eg `left`、`center`、`right` | string | `left` | diff --git a/src/packages/__VUE/input/doc.md b/src/packages/__VUE/input/doc.md index f330311526..b54db3323f 100644 --- a/src/packages/__VUE/input/doc.md +++ b/src/packages/__VUE/input/doc.md @@ -259,7 +259,7 @@ const val = ref(''); | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | -| v-model | 输入值,双向绑定 | string | - | +| v-model | 输入值,双向绑定 | string \| number | - | | type | 输入框类型,支持原生 `input` 标签的所有 `type` 属性,另外还支持 `number` `digit` | string | `text` | | placeholder | 输入框为空时占位符 | string | - | | input-align | 输入框内容对齐方式,可选值 `left`、`center`、`right` | string | `left` | diff --git a/src/packages/__VUE/input/doc.taro.md b/src/packages/__VUE/input/doc.taro.md index 7b07cf7dac..061129fa6c 100644 --- a/src/packages/__VUE/input/doc.taro.md +++ b/src/packages/__VUE/input/doc.taro.md @@ -272,7 +272,7 @@ const val = ref(''); | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | -| v-model | 输入值,双向绑定 | string | - | +| v-model | 输入值,双向绑定 | string \| number | - | | type | 输入框类型,支持原生 `input` 标签的所有 `type` 属性,另外还支持 `number` `digit` | string | `text` | | placeholder | 输入框为空时占位符 | string | - | | input-align | 输入框内容对齐方式,可选值 `left`、`center`、`right` | string | `left` | diff --git a/src/packages/__VUE/input/index.taro.vue b/src/packages/__VUE/input/index.taro.vue index 663d562f92..a40c96b460 100644 --- a/src/packages/__VUE/input/index.taro.vue +++ b/src/packages/__VUE/input/index.taro.vue @@ -34,13 +34,13 @@ > - {{ modelValue ? modelValue.length : 0 }}{{ getModelValue() ? getModelValue().length : 0 }}/{{ maxLength }} @@ -74,7 +74,7 @@ export default create({ default: 'text' }, modelValue: { - type: String, + type: [String, Number], default: '' }, placeholder: { @@ -350,7 +350,8 @@ export default create({ onClick, onClickInput, onConfirm, - onKeyup + onKeyup, + getModelValue }; } }); diff --git a/src/packages/__VUE/input/index.vue b/src/packages/__VUE/input/index.vue index f72a8e5769..7293b63e4d 100644 --- a/src/packages/__VUE/input/index.vue +++ b/src/packages/__VUE/input/index.vue @@ -29,13 +29,13 @@ @keyup="onKeyup" > - {{ modelValue ? modelValue.length : 0 }}{{ getModelValue() ? getModelValue().length : 0 }}/{{ maxLength }} @@ -68,7 +68,7 @@ export default create({ default: 'text' }, modelValue: { - type: String, + type: [String, Number], default: '' }, placeholder: { @@ -317,7 +317,8 @@ export default create({ focus, blur, select, - onKeyup + onKeyup, + getModelValue }; } });