From 0d9d4769a6217d86f898be9753323ac5ed7ebf7f Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 12 Oct 2023 17:40:10 +0800 Subject: [PATCH] fix(component): value ?? defaultValue --- src/input/input.ts | 4 ++-- src/input/props.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/input/input.ts b/src/input/input.ts index 76689a5de..d60ef46e4 100644 --- a/src/input/input.ts +++ b/src/input/input.ts @@ -36,8 +36,8 @@ export default class Input extends SuperComponent { lifetimes = { ready() { - const { value } = this.properties; - this.updateValue(value == null ? '' : value); + const { value, defaultValue } = this.properties; + this.updateValue(value == null ? defaultValue : value); }, }; diff --git a/src/input/props.ts b/src/input/props.ts index 61a6c00a8..d59119b54 100644 --- a/src/input/props.ts +++ b/src/input/props.ts @@ -105,6 +105,7 @@ const props: TdInputProps = { defaultValue: { type: String, optionalTypes: [Number], + value: '', }, /** input 的类型。
具体释义:
`text` 文本输入键盘;
`number` 数字输入键盘;
`idcard` 身份证输入键盘;
`digit` 带小数点的数字键盘;
`safe-password` 密码安全输入键盘 指引
`nickname` 昵称输入键盘。
[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/input.html) */ type: {