Skip to content

Commit e81cdda

Browse files
committed
fix: update backtop demos
1 parent 5a5f7c4 commit e81cdda

File tree

7 files changed

+14
-55
lines changed

7 files changed

+14
-55
lines changed

src/packages/backtop/demo.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@ const BackTopDemo = () => {
1717

1818
return (
1919
<>
20-
<div
21-
className="demo"
22-
style={{ height: '100vh', overflowY: 'auto' }}
23-
id="target"
24-
>
20+
<div className="demo" style={{ height: '100vh' }} id="target">
2521
<h2>{translated.title}</h2>
2622
<Demo1 />
2723
</div>

src/packages/backtop/demos/h5/demo3.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const Demo3 = () => {
88
{new Array(24).fill(0).map((_, index) => {
99
return <Cell key={index}>我是测试数据{index}</Cell>
1010
})}
11-
<BackTop threshold={100}>
11+
<BackTop threshold={100} target="target">
1212
<div
1313
style={{
1414
display: 'flex',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const Demo5 = () => {
77
console.log('触发返回顶部')
88
}
99
return (
10-
<div style={{ height: '100vh', overflowY: 'auto' }} id="target">
10+
<div style={{ height: '100vh' }} id="target">
1111
{new Array(24).fill(0).map((_, index) => {
1212
return <Cell key={index}>我是测试数据{index}</Cell>
1313
})}
Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,14 @@
11
import React from 'react'
22
import { BackTop, Cell } from '@nutui/nutui-react-taro'
3-
import { Top } from '@nutui/icons-react-taro'
43

54
const Demo1 = () => {
65
return (
7-
<div>
6+
<>
87
{new Array(24).fill(0).map((_, index) => {
98
return <Cell key={index}>我是测试数据{index}</Cell>
109
})}
11-
<BackTop
12-
threshold={200}
13-
style={{
14-
bottom: '50px',
15-
insetInlineEnd: '20px',
16-
}}
17-
>
18-
<div
19-
style={{
20-
display: 'flex',
21-
flexDirection: 'column',
22-
alignItems: 'center',
23-
}}
24-
>
25-
<Top size={12} />
26-
<div style={{ fontSize: '12px' }}>顶部</div>
27-
</div>
28-
</BackTop>
29-
</div>
10+
<BackTop />
11+
</>
3012
)
3113
}
3214
export default Demo1

src/packages/backtop/demos/taro/demo2.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import { BackTop, Cell } from '@nutui/nutui-react-taro'
33

44
const Demo2 = () => {
55
return (
6-
<div style={{ height: '100vh' }}>
6+
<>
77
{new Array(24).fill(0).map((_, index) => {
88
return <Cell key={index}>我是测试数据{index}</Cell>
99
})}
1010
<BackTop threshold={200} />
11-
</div>
11+
</>
1212
)
1313
}
1414
export default Demo2

src/packages/backtop/demos/taro/demo3.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { BackTop, Cell } from '@nutui/nutui-react-taro'
44

55
const Demo3 = () => {
66
return (
7-
<div style={{ height: '100vh' }}>
7+
<>
88
{new Array(24).fill(0).map((_, index) => {
99
return <Cell key={index}>我是测试数据{index}</Cell>
1010
})}
11-
<BackTop threshold={100}>
11+
<BackTop>
1212
<div
1313
style={{
1414
display: 'flex',
@@ -20,7 +20,7 @@ const Demo3 = () => {
2020
<div style={{ fontSize: '12px' }}>顶部</div>
2121
</div>
2222
</BackTop>
23-
</div>
23+
</>
2424
)
2525
}
2626
export default Demo3
Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react'
22
import { BackTop, Cell } from '@nutui/nutui-react-taro'
3-
import { Top } from '@nutui/icons-react-taro'
43

54
const Demo4 = () => {
65
const handleClick = () => {
@@ -11,30 +10,12 @@ const Demo4 = () => {
1110
minHeight: 'auto',
1211
}
1312
return (
14-
<div style={demoStyle} id="target">
13+
<>
1514
{new Array(24).fill(0).map((_, index) => {
1615
return <Cell key={index}>我是测试数据{index}</Cell>
1716
})}
18-
<BackTop
19-
threshold={200}
20-
style={{
21-
bottom: '50px',
22-
right: '20px',
23-
}}
24-
onClick={handleClick}
25-
>
26-
<div
27-
style={{
28-
display: 'flex',
29-
flexDirection: 'column',
30-
alignItems: 'center',
31-
}}
32-
>
33-
<Top size={12} />
34-
<div style={{ fontSize: '12px' }}>顶部</div>
35-
</div>
36-
</BackTop>
37-
</div>
17+
<BackTop onClick={handleClick} />
18+
</>
3819
)
3920
}
4021
export default Demo4

0 commit comments

Comments
 (0)