Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b6edc5f5
authored
Nov 24, 2025
by
panda7
Committed by
GitHub
Nov 24, 2025
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: centered 为 true 时设置 draggable 无法拖拽 (#6948)
Co-authored-by: sqchen <chenshiqi@sshlx.com>
1 parent
8b0f1381
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
packages/@core/ui-kit/popup-ui/src/modal/modal.vue
packages/@core/ui-kit/popup-ui/src/modal/use-modal-draggable.ts
packages/@core/ui-kit/popup-ui/src/modal/modal.vue
View file @
b6edc5f
...
@@ -104,6 +104,10 @@ const shouldDraggable = computed(
...
@@ -104,6 +104,10 @@ const shouldDraggable = computed(
()
=>
draggable
.
value
&&
!
shouldFullscreen
.
value
&&
header
.
value
,
()
=>
draggable
.
value
&&
!
shouldFullscreen
.
value
&&
header
.
value
,
);
);
const
shouldCentered
=
computed
(
()
=>
centered
.
value
&&
!
shouldFullscreen
.
value
,
);
const
getAppendTo
=
computed
(()
=>
{
const
getAppendTo
=
computed
(()
=>
{
return
appendToMain
.
value
return
appendToMain
.
value
?
`#
${
ELEMENT_ID_MAIN_CONTENT
}
>div:not(.absolute)>div`
?
`#
${
ELEMENT_ID_MAIN_CONTENT
}
>div:not(.absolute)>div`
...
@@ -115,6 +119,7 @@ const { dragging, transform } = useModalDraggable(
...
@@ -115,6 +119,7 @@ const { dragging, transform } = useModalDraggable(
headerRef
,
headerRef
,
shouldDraggable
,
shouldDraggable
,
getAppendTo
,
getAppendTo
,
shouldCentered
,
);
);
const
firstOpened
=
ref
(
false
);
const
firstOpened
=
ref
(
false
);
...
@@ -132,7 +137,9 @@ watch(
...
@@ -132,7 +137,9 @@ watch(
dialogRef
.
value
=
innerContentRef
.
$el
;
dialogRef
.
value
=
innerContentRef
.
$el
;
// reopen modal reassign value
// reopen modal reassign value
const
{
offsetX
,
offsetY
}
=
transform
;
const
{
offsetX
,
offsetY
}
=
transform
;
dialogRef
.
value
.
style
.
transform
=
`translate(
${
offsetX
}
px,
${
offsetY
}
px)`
;
dialogRef
.
value
.
style
.
transform
=
shouldCentered
.
value
?
`translate(
${
offsetX
}
px, calc(-50% +
${
offsetY
}
px))`
:
`translate(
${
offsetX
}
px,
${
offsetY
}
px)`
;
}
}
},
},
{
immediate
:
true
},
{
immediate
:
true
},
...
@@ -239,7 +246,7 @@ function handleClosed() {
...
@@ -239,7 +246,7 @@ function handleClosed() {
'shadow-3xl': !bordered,
'shadow-3xl': !bordered,
'left-0 top-0 size-full max-h-full !translate-x-0 !translate-y-0':
'left-0 top-0 size-full max-h-full !translate-x-0 !translate-y-0':
shouldFullscreen,
shouldFullscreen,
'top-1/2
!-translate-y-1/2
': centered
&&
!shouldFullscreen,
'top-1/2': centered
&&
!shouldFullscreen,
'duration-300': !dragging,
'duration-300': !dragging,
hidden: isClosed,
hidden: isClosed,
},
},
...
...
packages/@core/ui-kit/popup-ui/src/modal/use-modal-draggable.ts
View file @
b6edc5f
...
@@ -14,6 +14,7 @@ export function useModalDraggable(
...
@@ -14,6 +14,7 @@ export function useModalDraggable(
dragRef
:
Ref
<
HTMLElement
|
undefined
>
,
dragRef
:
Ref
<
HTMLElement
|
undefined
>
,
draggable
:
ComputedRef
<
boolean
>
,
draggable
:
ComputedRef
<
boolean
>
,
containerSelector
?:
ComputedRef
<
string
|
undefined
>
,
containerSelector
?:
ComputedRef
<
string
|
undefined
>
,
centered
?:
ComputedRef
<
boolean
>
,
)
{
)
{
const
transform
=
reactive
({
const
transform
=
reactive
({
offsetX
:
0
,
offsetX
:
0
,
...
@@ -73,7 +74,10 @@ export function useModalDraggable(
...
@@ -73,7 +74,10 @@ export function useModalDraggable(
transform
.
offsetY
=
moveY
;
transform
.
offsetY
=
moveY
;
if
(
targetRef
.
value
)
{
if
(
targetRef
.
value
)
{
targetRef
.
value
.
style
.
transform
=
`translate(
${
moveX
}
px,
${
moveY
}
px)`
;
const
isCentered
=
centered
?.
value
;
targetRef
.
value
.
style
.
transform
=
isCentered
?
`translate(
${
moveX
}
px, calc(-50% +
${
moveY
}
px))`
:
`translate(
${
moveX
}
px,
${
moveY
}
px)`
;
dragging
.
value
=
true
;
dragging
.
value
=
true
;
}
}
};
};
...
@@ -108,7 +112,7 @@ export function useModalDraggable(
...
@@ -108,7 +112,7 @@ export function useModalDraggable(
const
target
=
unrefElement
(
targetRef
);
const
target
=
unrefElement
(
targetRef
);
if
(
target
)
{
if
(
target
)
{
target
.
style
.
transform
=
'
none
'
;
target
.
style
.
transform
=
''
;
}
}
};
};
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment