Skip to content

Commit d8d4501

Browse files
committed
fix(input): 不用 get 方法,直接使用 nativeElement
2 parents 9c689ff + c20801d commit d8d4501

40 files changed

+335
-432
lines changed

src/packages/configprovider/demo.taro.tsx

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,36 @@ import Header from '@/sites/components/header'
66
import Demo1 from './demos/taro/demo1'
77
import Demo2 from './demos/taro/demo2'
88
import Demo3 from './demos/taro/demo3'
9-
import Demo4 from './demos/taro/demo4'
10-
import Demo5 from './demos/taro/demo5'
119
import { useTranslate } from '@/sites/assets/locale/taro'
1210

1311
const ConfigProviderDemo = () => {
1412
const [translated] = useTranslate({
1513
'zh-CN': {
16-
title1: 'Textarea 默认-禁用',
17-
title2: 'Textarea 英文-禁用',
18-
defaultTheme: '默认主题',
19-
customTheme: `定制主题${harmony() ? '【暂不支持】' : ''}`,
14+
text: 'Textarea 中文与英文',
15+
theme: '默认主题与定制主题',
2016
RTL: harmony() ? 'RTL【暂不支持】' : 'RTL',
2117
},
2218
'zh-TW': {
23-
title1: 'Textarea 默認用法-禁用',
24-
title2: 'Textarea 英文-禁用',
25-
defaultTheme: '默認主題',
26-
customTheme: `定制主題${harmony() ? '【暂不支持】' : ''}`,
19+
text: 'Textarea 中文与英文',
20+
theme: '默認主題与定制主題',
2721
RTL: harmony() ? 'RTL【暂不支持】' : 'RTL',
2822
},
2923
'en-US': {
30-
title1: 'Textarea default + disabled',
31-
title2: 'Textarea en-US + disabled',
32-
customTheme: 'Custom Theme',
33-
defaultTheme: `Default Theme ${harmony() ? '[Pendding]' : ''}`,
24+
text: 'Textarea zh-CN and en-US',
25+
theme: 'Default Theme And Custom Theme',
3426
RTL: harmony() ? 'RTL[Pendding]' : 'RTL',
3527
},
3628
})
3729
return (
3830
<>
3931
<Header />
4032
<ScrollView className={`demo ${Taro.getEnv() === 'WEB' ? 'web' : ''}`}>
41-
<View className="h2">{translated.defaultTheme}</View>
33+
<View className="h2">{translated.theme}</View>
4234
<Demo1 />
43-
<View className="h2">{translated.customTheme}</View>
35+
<View className="h2">{translated.text}</View>
4436
<Demo2 />
45-
<View className="h2">{translated.title1}</View>
46-
<Demo3 />
47-
<View className="h2">{translated.title2}</View>
48-
<Demo4 />
4937
<View className="h2">{translated.RTL}</View>
50-
<Demo5 />
38+
<Demo3 />
5139
</ScrollView>
5240
</>
5341
)

src/packages/configprovider/demo.tsx

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,32 @@ import React from 'react'
22
import Demo1 from './demos/h5/demo1'
33
import Demo2 from './demos/h5/demo2'
44
import Demo3 from './demos/h5/demo3'
5-
import Demo4 from './demos/h5/demo4'
6-
import Demo5 from './demos/h5/demo5'
75
import { useTranslate } from '@/sites/assets/locale'
86

97
const ConfigProviderDemo = () => {
108
const [translated] = useTranslate({
119
'zh-CN': {
12-
title1: 'Textarea 默认',
13-
title2: 'Textarea 英文',
14-
defaultTheme: '默认主题',
15-
customTheme: '定制主题',
10+
text: 'Textarea 中文与英文',
11+
theme: '默认主题与定制主题',
1612
},
1713
'zh-TW': {
18-
title1: '默認用法',
19-
title2: 'Textarea 英文',
20-
defaultTheme: '默認主題',
21-
customTheme: '定制主題',
14+
text: 'Textarea 中文与英文',
15+
theme: '默認主題与定制主題',
2216
},
2317
'en-US': {
24-
title1: 'Textarea default',
25-
title2: 'Textarea en-US',
26-
customTheme: 'Custom Theme',
27-
defaultTheme: 'Default Theme',
18+
text: 'Textarea zh-CN and en-US',
19+
theme: 'Default Theme And Custom Theme',
2820
},
2921
})
3022
return (
3123
<>
3224
<div className="demo">
33-
<h2>{translated.defaultTheme}</h2>
25+
<h2>{translated.theme}</h2>
3426
<Demo1 />
35-
<h2>{translated.customTheme}</h2>
27+
<h2>{translated.text}</h2>
3628
<Demo2 />
37-
<h2>{translated.title1}</h2>
38-
<Demo3 />
39-
<h2>{translated.title2}</h2>
40-
<Demo4 />
4129
<h2>RTL</h2>
42-
<Demo5 />
30+
<Demo3 />
4331
</div>
4432
</>
4533
)

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import React from 'react'
22
import { ConfigProvider, Cell, Rate, Button } from '@nutui/nutui-react'
33

4-
const Demo1 = () => {
4+
const Demo = () => {
5+
const darkTheme = {
6+
nutuiColorPrimaryIcon: 'green',
7+
nutuiColorPrimaryStop1: 'green',
8+
nutuiColorPrimaryStop2: 'green',
9+
}
510
return (
611
<>
712
<ConfigProvider>
@@ -16,8 +21,20 @@ const Demo1 = () => {
1621
</Cell>
1722
</Cell.Group>
1823
</ConfigProvider>
24+
<ConfigProvider theme={darkTheme}>
25+
<Cell.Group>
26+
<Cell>
27+
<Rate defaultValue={3} />
28+
</Cell>
29+
<Cell>
30+
<Button type="primary" block>
31+
提交
32+
</Button>
33+
</Cell>
34+
</Cell.Group>
35+
</ConfigProvider>
1936
</>
2037
)
2138
}
2239

23-
export default Demo1
40+
export default Demo
Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
11
import React from 'react'
2-
import { ConfigProvider, Cell, Rate, Button } from '@nutui/nutui-react'
2+
import { ConfigProvider, TextArea, Cell } from '@nutui/nutui-react'
3+
import enUS from '@nutui/nutui-react/dist/es/locale/en-US'
34

4-
const Demo2 = () => {
5-
const darkTheme = {
6-
nutuiColorPrimaryIcon: 'green',
7-
nutuiColorPrimaryStop1: 'green',
8-
nutuiColorPrimaryStop2: 'green',
9-
}
5+
const Demo = () => {
106
return (
117
<>
12-
<ConfigProvider theme={darkTheme}>
13-
<Cell.Group>
14-
<Cell>
15-
<Rate defaultValue={3} />
16-
</Cell>
17-
<Cell>
18-
<Button type="primary" block>
19-
提交
20-
</Button>
21-
</Cell>
22-
</Cell.Group>
8+
<ConfigProvider>
9+
<Cell>
10+
<TextArea disabled showCount maxLength={20} />
11+
</Cell>
12+
</ConfigProvider>
13+
<ConfigProvider locale={enUS}>
14+
<Cell>
15+
<TextArea disabled showCount maxLength={20} />
16+
</Cell>
2317
</ConfigProvider>
2418
</>
2519
)
2620
}
2721

28-
export default Demo2
22+
export default Demo
Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
import React from 'react'
2-
import { ConfigProvider, TextArea } from '@nutui/nutui-react'
2+
import { ConfigProvider, Cell } from '@nutui/nutui-react'
33

4-
const Demo3 = () => {
4+
const Demo = () => {
55
return (
66
<>
7-
<ConfigProvider>
8-
<TextArea disabled showCount maxLength={20} />
7+
<ConfigProvider direction="rtl">
8+
<Cell
9+
title={
10+
<div>
11+
<span>我是标题</span>
12+
</div>
13+
}
14+
description={<span>我是描述</span>}
15+
extra="描述文字"
16+
/>
917
</ConfigProvider>
1018
</>
1119
)
1220
}
1321

14-
export default Demo3
22+
export default Demo

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

Lines changed: 0 additions & 15 deletions
This file was deleted.

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

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/packages/configprovider/demos/taro/demo1.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import React from 'react'
22
import { ConfigProvider, Cell, Button, Rate } from '@nutui/nutui-react-taro'
33

4-
const Demo1 = () => {
4+
const Demo = () => {
5+
const darkTheme = {
6+
nutuiColorPrimaryIcon: 'green',
7+
nutuiColorPrimaryStop1: 'green',
8+
nutuiColorPrimaryStop2: 'green',
9+
}
510
return (
611
<>
712
<ConfigProvider>
@@ -16,8 +21,20 @@ const Demo1 = () => {
1621
</Cell>
1722
</Cell.Group>
1823
</ConfigProvider>
24+
<ConfigProvider theme={darkTheme}>
25+
<Cell.Group>
26+
<Cell>
27+
<Rate defaultValue={3} />
28+
</Cell>
29+
<Cell>
30+
<Button type="primary" block>
31+
提交
32+
</Button>
33+
</Cell>
34+
</Cell.Group>
35+
</ConfigProvider>
1936
</>
2037
)
2138
}
2239

23-
export default Demo1
40+
export default Demo
Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
11
import React from 'react'
2-
import { ConfigProvider, Cell, Button, Rate } from '@nutui/nutui-react-taro'
2+
import { ConfigProvider, TextArea, Cell } from '@nutui/nutui-react-taro'
3+
import enUS from '@nutui/nutui-react-taro/dist/es/locales/en-US'
34

4-
const Demo2 = () => {
5-
const darkTheme = {
6-
nutuiColorPrimaryIcon: 'green',
7-
nutuiColorPrimaryStop1: 'green',
8-
nutuiColorPrimaryStop2: 'green',
9-
}
5+
const Demo = () => {
106
return (
117
<>
12-
<ConfigProvider theme={darkTheme}>
13-
<Cell.Group>
14-
<Cell>
15-
<Rate defaultValue={3} />
16-
</Cell>
17-
<Cell>
18-
<Button type="primary" block>
19-
提交
20-
</Button>
21-
</Cell>
22-
</Cell.Group>
8+
<ConfigProvider>
9+
<Cell>
10+
<TextArea disabled showCount maxLength={20} />
11+
</Cell>
12+
</ConfigProvider>
13+
<ConfigProvider locale={enUS}>
14+
<Cell>
15+
<TextArea disabled showCount maxLength={20} />
16+
</Cell>
2317
</ConfigProvider>
2418
</>
2519
)
2620
}
2721

28-
export default Demo2
22+
export default Demo
Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
import React from 'react'
2-
import { ConfigProvider, TextArea } from '@nutui/nutui-react-taro'
2+
import { View, Text } from '@tarojs/components'
3+
import { ConfigProvider, Cell, pxTransform } from '@nutui/nutui-react-taro'
34

4-
const Demo3 = () => {
5+
const Demo = () => {
56
return (
67
<>
7-
<ConfigProvider>
8-
<TextArea disabled showCount maxLength={20} />
8+
<ConfigProvider direction="rtl">
9+
<Cell
10+
title={
11+
<View>
12+
<Text style={{ fontSize: pxTransform(14) }}>我是标题</Text>
13+
</View>
14+
}
15+
description={
16+
<Text style={{ fontSize: pxTransform(12), color: '#ccc' }}>
17+
我是描述
18+
</Text>
19+
}
20+
extra="描述文字"
21+
/>
922
</ConfigProvider>
1023
</>
1124
)
1225
}
1326

14-
export default Demo3
27+
export default Demo

0 commit comments

Comments
 (0)