Skip to content

Commit

Permalink
fix: popup 不该是 overflow-y auto
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyatong committed Dec 9, 2024
1 parent 71e34d2 commit 808e9cc
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 25 deletions.
1 change: 0 additions & 1 deletion src/packages/cascader/cascader.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,6 @@ const InternalCascader: ForwardRefRenderFunction<
{...popupProps}
visible={innerVisible}
position="bottom"
style={{ overflowY: 'hidden' }}
round
closeIcon={closeIcon}
closeable={closeable}
Expand Down
21 changes: 12 additions & 9 deletions src/packages/popup/demos/h5/demo1.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import React, { useState } from 'react'
import { Popup, Cell } from '@nutui/nutui-react'

const Demo1 = () => {
const [showBasic, setShowBasic] = useState(false)
const Demo = () => {
const [showIcon, setShowIcon] = useState(false)

return (
<>
<Cell
title="展示弹出层"
title="基础弹框"
onClick={() => {
setShowBasic(true)
setShowIcon(true)
}}
/>
<Popup
zIndex={2000}
visible={showBasic}
style={{ padding: '30px 50px' }}
closeable
visible={showIcon}
title="标题"
description="这里是副标题这是副标题"
position="bottom"
onClose={() => {
setShowBasic(false)
setShowIcon(false)
}}
/>
</>
)
}
export default Demo1
export default Demo
24 changes: 22 additions & 2 deletions src/packages/popup/demos/h5/demo2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const Demo2 = () => {
const [showBottom, setShowBottom] = useState(false)
const [showLeft, setShowLeft] = useState(false)
const [showRight, setShowRight] = useState(false)
const [showText, setShowText] = useState(false)

return (
<>
Expand Down Expand Up @@ -33,6 +34,12 @@ const Demo2 = () => {
setShowRight(true)
}}
/>
<Cell
title="居中弹出"
onClick={() => {
setShowText(true)
}}
/>
<Popup
visible={showTop}
destroyOnClose
Expand All @@ -50,20 +57,33 @@ const Demo2 = () => {
/>
<Popup
visible={showLeft}
style={{ width: '40%', height: '100%' }}
position="left"
onClose={() => {
setShowLeft(false)
}}
/>
<Popup
visible={showRight}
style={{ width: '40%', height: '100%' }}
position="right"
onClose={() => {
setShowRight(false)
}}
/>
<Popup
visible={showText}
style={{ padding: '30px 50px' }}
onClose={() => {
setShowText(false)
}}
>
<div style={{ height: '100px', overflowY: 'auto' }}>
{Array.from({ length: 10 })
.fill('')
.map((_, i) => (
<Cell key={i}>正文</Cell>
))}
</div>
</Popup>
</>
)
}
Expand Down
14 changes: 2 additions & 12 deletions src/packages/popup/demos/taro/demo2.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react'
import { Popup, Cell } from '@nutui/nutui-react-taro'
import { ScrollView, View, Text } from '@tarojs/components'
import { ScrollView, Text } from '@tarojs/components'

const Demo2 = () => {
const [showTop, setShowTop] = useState(false)
Expand Down Expand Up @@ -58,17 +58,7 @@ const Demo2 = () => {
setShowBottom(false)
}}
lockScroll
>
<ScrollView scrollY style={{ height: '240px' }}>
{Array.from({ length: 200 })
.fill('')
.map((_, i) => (
<View key={i}>
<Cell>底部弹出-{i}</Cell>
</View>
))}
</ScrollView>
</Popup>
/>
<Popup
visible={showLeft}
style={{ width: '20%' }}
Expand Down
1 change: 0 additions & 1 deletion src/packages/popup/popup.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
position: fixed;
min-height: 46%;
max-height: 100%;
overflow-y: auto;
background-color: $overlay-content-bg-color;
-webkit-overflow-scrolling: touch;
font-size: $font-size-base;
Expand Down

0 comments on commit 808e9cc

Please sign in to comment.