Skip to content

Commit

Permalink
fix: update backtop demos (#2865)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyatong authored Dec 24, 2024
1 parent 9be61bf commit c53503a
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 55 deletions.
6 changes: 1 addition & 5 deletions src/packages/backtop/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ const BackTopDemo = () => {

return (
<>
<div
className="demo"
style={{ height: '100vh', overflowY: 'auto' }}
id="target"
>
<div className="demo" style={{ height: '100vh' }} id="target">
<h2>{translated.title}</h2>
<Demo1 />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/packages/backtop/demos/h5/demo3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Demo3 = () => {
{new Array(24).fill(0).map((_, index) => {
return <Cell key={index}>我是测试数据{index}</Cell>
})}
<BackTop threshold={100}>
<BackTop threshold={100} target="target">
<div
style={{
display: 'flex',
Expand Down
2 changes: 1 addition & 1 deletion src/packages/backtop/demos/h5/demo5.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Demo5 = () => {
console.log('触发返回顶部')
}
return (
<div style={{ height: '100vh', overflowY: 'auto' }} id="target">
<div style={{ height: '100vh' }} id="target">
{new Array(24).fill(0).map((_, index) => {
return <Cell key={index}>我是测试数据{index}</Cell>
})}
Expand Down
24 changes: 3 additions & 21 deletions src/packages/backtop/demos/taro/demo1.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
import React from 'react'
import { BackTop, Cell } from '@nutui/nutui-react-taro'
import { Top } from '@nutui/icons-react-taro'

const Demo1 = () => {
return (
<div>
<>
{new Array(24).fill(0).map((_, index) => {
return <Cell key={index}>我是测试数据{index}</Cell>
})}
<BackTop
threshold={200}
style={{
bottom: '50px',
insetInlineEnd: '20px',
}}
>
<div
style={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
}}
>
<Top size={12} />
<div style={{ fontSize: '12px' }}>顶部</div>
</div>
</BackTop>
</div>
<BackTop />
</>
)
}
export default Demo1
4 changes: 2 additions & 2 deletions src/packages/backtop/demos/taro/demo2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { BackTop, Cell } from '@nutui/nutui-react-taro'

const Demo2 = () => {
return (
<div style={{ height: '100vh' }}>
<>
{new Array(24).fill(0).map((_, index) => {
return <Cell key={index}>我是测试数据{index}</Cell>
})}
<BackTop threshold={200} />
</div>
</>
)
}
export default Demo2
6 changes: 3 additions & 3 deletions src/packages/backtop/demos/taro/demo3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { BackTop, Cell } from '@nutui/nutui-react-taro'

const Demo3 = () => {
return (
<div style={{ height: '100vh' }}>
<>
{new Array(24).fill(0).map((_, index) => {
return <Cell key={index}>我是测试数据{index}</Cell>
})}
<BackTop threshold={100}>
<BackTop>
<div
style={{
display: 'flex',
Expand All @@ -20,7 +20,7 @@ const Demo3 = () => {
<div style={{ fontSize: '12px' }}>顶部</div>
</div>
</BackTop>
</div>
</>
)
}
export default Demo3
25 changes: 3 additions & 22 deletions src/packages/backtop/demos/taro/demo4.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react'
import { BackTop, Cell } from '@nutui/nutui-react-taro'
import { Top } from '@nutui/icons-react-taro'

const Demo4 = () => {
const handleClick = () => {
Expand All @@ -11,30 +10,12 @@ const Demo4 = () => {
minHeight: 'auto',
}
return (
<div style={demoStyle} id="target">
<>
{new Array(24).fill(0).map((_, index) => {
return <Cell key={index}>我是测试数据{index}</Cell>
})}
<BackTop
threshold={200}
style={{
bottom: '50px',
right: '20px',
}}
onClick={handleClick}
>
<div
style={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
}}
>
<Top size={12} />
<div style={{ fontSize: '12px' }}>顶部</div>
</div>
</BackTop>
</div>
<BackTop onClick={handleClick} />
</>
)
}
export default Demo4

0 comments on commit c53503a

Please sign in to comment.