Skip to content

Commit f764c71

Browse files
authored
feat: intput v15 (#2889)
* feat: intput v15 * feat: intput v15
1 parent bb0685f commit f764c71

31 files changed

+234
-275
lines changed

migrate-from-v2.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,10 @@ plugins: [
410410

411411
#### Input
412412

413+
- 新增 `plain` 属性,标记为 纯文本型;该值默认为false,标记为 container 容器型;
414+
- 区分了 readonly 和 disabled 的样式;
415+
- 删除一些样式变量,统一到由通用变量控制,如`$input-color``$input-disabled-color`
416+
413417
#### InputNumber
414418

415419
- 增加 `allowEmpty`, 用于允许内容是否为空

src/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,7 @@
539539
"sort": 1,
540540
"show": true,
541541
"taro": true,
542+
"v15": true,
542543
"author": "VickyYe"
543544
},
544545
{

src/packages/formitem/formitem.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.nut-form-item {
22
display: flex;
3+
align-items: center;
4+
padding: 4px 12px;
35

46
&.error {
57
&.line {

src/packages/input/demos/h5/demo1.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import React from 'react'
2-
import { Input } from '@nutui/nutui-react'
2+
import { Divider, Input } from '@nutui/nutui-react'
33

44
const Demo1 = () => {
55
return (
66
<>
7-
<Input placeholder="请输入文本" />
7+
<Input placeholder="请输入文本:容器型" />
8+
<Divider />
9+
<Input placeholder="请输入文本:纯文本型" plain />
810
</>
911
)
1012
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import React from 'react'
2-
import { Input } from '@nutui/nutui-react'
2+
import { Input, Space } from '@nutui/nutui-react'
33

44
const Demo10 = () => {
55
const formatter = (value: string) => value.replace(/\d/g, '')
66
return (
7-
<>
7+
<Space direction="vertical" style={{ marginBottom: 10 }}>
88
<Input formatter={formatter} placeholder="在输入时移除数字" />
99
<Input
1010
formatter={formatter}
1111
formatTrigger="onBlur"
1212
placeholder="在失焦时移除数字"
1313
/>
14-
</>
14+
</Space>
1515
)
1616
}
1717
export default Demo10
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React from 'react'
2-
import { Input } from '@nutui/nutui-react'
2+
import { Input, Space } from '@nutui/nutui-react'
33

44
const Demo11 = () => {
55
return (
6-
<>
6+
<Space direction="vertical" style={{ marginBottom: 10 }}>
77
<Input align="left" placeholder="文本内容对齐" />
88
<Input align="right" placeholder="文本内容对齐" />
9-
</>
9+
</Space>
1010
)
1111
}
1212
export default Demo11

src/packages/input/demos/h5/demo13.tsx

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,25 @@ import { Tips } from '@nutui/icons-react'
44

55
const Demo13 = () => {
66
return (
7-
<>
8-
<div
9-
style={{
10-
display: 'flex',
11-
alignItems: 'center',
12-
background: '#fff',
13-
padding: '0 10px',
14-
}}
15-
>
16-
<Tips color="var(--nutui-gray-7)" />
17-
<Input
18-
placeholder="请输入短信验证码"
19-
style={{ '--nutui-input-padding': '10px' }}
20-
/>
21-
<div className="right">
22-
<Button type="primary" size="small">
23-
获取验证码
24-
</Button>
25-
</div>
7+
<div
8+
style={{
9+
display: 'flex',
10+
alignItems: 'center',
11+
background: '#fff',
12+
padding: '0 10px',
13+
}}
14+
>
15+
<Tips color="var(--nutui-gray-7)" />
16+
<Input
17+
placeholder="请输入短信验证码"
18+
style={{ '--nutui-input-padding': '10px' }}
19+
/>
20+
<div className="right">
21+
<Button type="primary" size="small">
22+
获取验证码
23+
</Button>
2624
</div>
27-
</>
25+
</div>
2826
)
2927
}
3028
export default Demo13

src/packages/input/demos/h5/demo4.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import React from 'react'
2-
import { Input } from '@nutui/nutui-react'
2+
import { Input, Space } from '@nutui/nutui-react'
33

44
const Demo4 = () => {
55
return (
6-
<>
6+
<Space direction="vertical" style={{ marginBottom: 10 }}>
77
<Input type="text" placeholder="请输入文本" />
88
<Input type="password" placeholder="请输入密码" />
99
<Input type="digit" placeholder="请输入数字" />
1010
<Input type="number" placeholder="请输入整数" />
11-
</>
11+
</Space>
1212
)
1313
}
1414
export default Demo4

src/packages/input/demos/h5/demo5.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React from 'react'
2-
import { Input } from '@nutui/nutui-react'
2+
import { Input, Space } from '@nutui/nutui-react'
33

44
const Demo5 = () => {
55
return (
6-
<>
7-
<Input readOnly placeholder="输入框只读" />
6+
<Space direction="vertical" style={{ marginBottom: 10 }}>
7+
<Input readOnly value="输入框只读" />
88
<Input disabled placeholder="输入框禁用" />
9-
</>
9+
</Space>
1010
)
1111
}
1212
export default Demo5

src/packages/input/demos/h5/demo6.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React from 'react'
2-
import { Input } from '@nutui/nutui-react'
2+
import { Input, Space } from '@nutui/nutui-react'
33
import { Close } from '@nutui/icons-react'
44

55
const Demo6 = () => {
66
return (
7-
<>
7+
<Space direction="vertical" style={{ marginBottom: 10 }}>
88
<Input clearable placeholder="显示清除图标" />
99
<Input clearable clearIcon={<Close />} placeholder="显示清除图标" />
10-
</>
10+
</Space>
1111
)
1212
}
1313
export default Demo6

0 commit comments

Comments
 (0)