鼠标在弹窗标题字体上也可拖拽窗口

This commit is contained in:
dong 2023-12-22 15:25:26 +08:00
parent 0a96d88efc
commit b374bcddb1

View File

@ -27,7 +27,7 @@
:style="`height: ${props.titleHeight}px;background: ${props.titleColor}`"
>
<div
:style="`color:${props.fontColor};font-size: ${props.fontSize}px;`"
:style="`height: 100%; line-height: ${props.titleHeight}px; color:${props.fontColor};font-size: ${props.fontSize}px;`"
>
{{ props.title }}
</div>
@ -113,7 +113,7 @@ function onMouseUp() {
startOffset.y = 0;
}
function onMouseDown(e: MouseEvent) {
if (headerRef.value?.$el !== e.target) return;
if (!e.target || !headerRef.value?.$el.contains(e.target)) return;
startOffset.x = e.offsetX;
startOffset.y = e.offsetY;
start.x = e.clientX - offset.x;