feat: 更新上下文菜单拖拽功能,重命名位置变量以提高代码可读性
This commit is contained in:
parent
aa568b2da4
commit
990b0ee4b4
@ -69,7 +69,11 @@ const emit = defineEmits<Emits>();
|
|||||||
const menuRef = ref<HTMLElement | null>(null);
|
const menuRef = ref<HTMLElement | null>(null);
|
||||||
const handleRef = ref<HTMLElement | null>(null);
|
const handleRef = ref<HTMLElement | null>(null);
|
||||||
|
|
||||||
const { x, y, style } = useDraggable(menuRef, {
|
const {
|
||||||
|
x: positionX,
|
||||||
|
y: positionY,
|
||||||
|
style,
|
||||||
|
} = useDraggable(menuRef, {
|
||||||
handle: handleRef,
|
handle: handleRef,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -77,8 +81,8 @@ watch(
|
|||||||
() => props.visible,
|
() => props.visible,
|
||||||
(isVisible) => {
|
(isVisible) => {
|
||||||
if (isVisible) {
|
if (isVisible) {
|
||||||
x.value = props.x;
|
positionX.value = props.x;
|
||||||
y.value = props.y;
|
positionY.value = props.y;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user