From 6b6a4e960125585a3bd3c38884689ae2e644ece5 Mon Sep 17 00:00:00 2001
From: vickyYe <34928913+vickyYE@users.noreply.github.com>
Date: Mon, 24 Oct 2022 16:22:08 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20input=20=E6=95=B0=E6=8D=AE=E5=8F=98?=
=?UTF-8?q?=E5=8C=96=E6=8E=A7=E5=88=B6=E4=BE=8B=E5=AD=90=E8=A1=A5=E5=85=85?=
=?UTF-8?q?=20(#364)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/packages/input/demo.taro.tsx | 12 ++++++++----
src/packages/input/demo.tsx | 12 ++++++++----
src/packages/input/doc.en-US.md | 6 ++++--
src/packages/input/doc.md | 12 +++++++-----
src/packages/input/doc.zh-TW.md | 12 +++++++-----
5 files changed, 34 insertions(+), 20 deletions(-)
diff --git a/src/packages/input/demo.taro.tsx b/src/packages/input/demo.taro.tsx
index b47dc340d6..cdd5dbccc3 100644
--- a/src/packages/input/demo.taro.tsx
+++ b/src/packages/input/demo.taro.tsx
@@ -102,7 +102,7 @@ const InputDemo = () => {
placeholder5: 'Input Align',
},
})
- const [value1, UpdateValue1] = useState('')
+ const [value, UpdateValue] = useState('')
const [state, setState] = useState({
val1: '',
text: '',
@@ -128,7 +128,7 @@ const InputDemo = () => {
clear: '',
})
- const change = (value: string | number) => {
+ const change = (value: string | number, event: Event) => {
console.log('change: ', value)
}
const focus = (value: string | number, event: Event) => {
@@ -161,13 +161,17 @@ const InputDemo = () => {
{
+ console.log('change value:', val)
+ UpdateValue(val)
+ }}
/>
{translated.title1}
{
placeholder5: 'Input Align',
},
})
- const [value1, UpdateValue1] = useState('')
+ const [value, UpdateValue] = useState('')
const [state, setState] = useState({
val1: '',
text: '',
@@ -129,7 +129,7 @@ const InputDemo = () => {
clear: '',
})
- const change = (value: string | number) => {
+ const change = (value: string | number, event: Event) => {
console.log('change: ', value)
}
const focus = (value: string | number, event: Event) => {
@@ -162,13 +162,17 @@ const InputDemo = () => {
{
+ console.log('change value:', val)
+ UpdateValue(val)
+ }}
/>
{translated.title1}
{
const [value, UpdateValue] = useState('')
return (
<>
-
+ {
+ UpdateValue(val)
+ }}/>
>
);
};
@@ -423,7 +425,7 @@ export default App;
| Attribute | Description | Type | Default |
| ------------ | -------------------------------------- | -------------- | ------- |
-| defaultValue | Input value, two-way binding | String | - |
+| defaultValue | Input value | String | - |
| type | Input type, support all native types and `textarea` `number` `digit` type | String | `text` |
| placeholder | Placeholder when the input box is empty | String | - |
| label | Left text | String | - |
diff --git a/src/packages/input/doc.md b/src/packages/input/doc.md
index c87570c16e..932e35dac4 100644
--- a/src/packages/input/doc.md
+++ b/src/packages/input/doc.md
@@ -21,10 +21,12 @@ import React, { useState } from "react";
import { Input } from '@nutui/nutui-react';
const App = () => {
- const [value1, UpdateValue1] = useState('')
+ const [value, UpdateValue] = useState('')
return (
<>
-
+ {
+ UpdateValue(val)
+ }}/>
>
);
};
@@ -365,8 +367,8 @@ const App = () => {
const [state, setState] = useState({
event: '',
})
- const change = (value: string | number) => {
- console.log('change: ', value)
+ const change = (value: string | number, event: Event) => {
+ console.log('change: ', value, event)
}
const focus = (value: string | number, event: Event) => {
console.log('focus:', value, event)
@@ -417,7 +419,7 @@ export default App;
| 参数 | 说明 | 类型 | 默认值 |
| ------------ | -------------------------------------- | -------------- | ------- |
-| defaultValue | 初始默认值,双向绑定 | String | - |
+| defaultValue | 初始默认值 | String | - |
| type | 输入框类型,支持原生 `input` 标签的所有 `type` 属性,另外还支持 `textarea` `number` `digit` | String | `text` |
| placeholder | 输入框为空时占位符 | String | - |
| label | 左侧文本 | String | - |
diff --git a/src/packages/input/doc.zh-TW.md b/src/packages/input/doc.zh-TW.md
index bdd88c3521..18cfdc14bd 100644
--- a/src/packages/input/doc.zh-TW.md
+++ b/src/packages/input/doc.zh-TW.md
@@ -21,10 +21,12 @@ import React, { useState } from "react";
import { Input } from '@nutui/nutui-react';
const App = () => {
- const [value1, UpdateValue1] = useState('')
+ const [value, UpdateValue] = useState('')
return (
<>
-
+ {
+ UpdateValue(val)
+ }}/>
>
);
};
@@ -365,8 +367,8 @@ const App = () => {
const [state, setState] = useState({
event: '',
})
- const change = (value: string | number) => {
- console.log('change: ', value)
+ const change = (value: string | number, event: Event) => {
+ console.log('change: ', value, event)
}
const focus = (value: string | number, event: Event) => {
console.log('focus:', value, event)
@@ -417,7 +419,7 @@ export default App;
| 参数 | 说明 | 类型 | 默认值 |
| ------------ | -------------------------------------- | -------------- | ------- |
-| defaultValue | 初始默认值,双向绑定 | String | - |
+| defaultValue | 初始默认值 | String | - |
| type | 输入框类型,支持原生 `input` 标签的所有 `type` 属性,另外还支持 `textarea` `number` `digit` | String | `text` |
| placeholder | 输入框为空时占位符 | String | - |
| label | 左侧文本 | String | - |