Skip to content

Commit

Permalink
fix: 调整距离容器的位置
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyatong committed Dec 27, 2024
1 parent 1fd9736 commit 8fe2945
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/packages/popover/popover.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const defaultProps = {
theme: 'light',
location: 'bottom',
visible: false,
offset: [0, 12],
offset: [0, 4],
arrowOffset: 0,
targetId: '',
className: '',
Expand Down
4 changes: 3 additions & 1 deletion src/packages/popover/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const defaultProps = {
theme: 'light',
location: 'bottom',
visible: false,
offset: [0, 12],
offset: [0, 8],
arrowOffset: 0,
targetId: '',
showArrow: true,
Expand Down Expand Up @@ -186,11 +186,13 @@ export const Popover: FunctionComponent<
const skew = location.split('-')[1]
let cross = 0
let parallel = 0
console.log('offset', offset)
if (Array.isArray(offset) && offset.length === 2) {
const rtloffset = rtl ? -offset[0] : offset[0]
cross += +offset[1]
parallel += +rtloffset
}
console.log('offset', offset, parallel, cross, width, top, height)
if (width) {
const dir = rtl ? 'right' : 'left'
if (['bottom', 'top'].includes(direction)) {
Expand Down

0 comments on commit 8fe2945

Please sign in to comment.