Open
Description
我用npm安装后按照文档写了一个示例,发现水平和垂直的虚线是可以拖动并且有动画效果的, 但是无法将虚线固定到屏幕上. 即松开鼠标后虚线显示不见了.
后来发现是
<div :style="{top:verticalDottedTop + 'px'}" class="vue-ruler-ref-dot-h" /> <div :style="{left:horizontalDottedLeft + 'px'}" class="vue-ruler-ref-dot-v" />
中: style绑定的时候有问题.
我重新定义了两个响应式data: hStyle和lStyle,
修改上述代码为... :style="hStyle"
和...:style="lStyle"
, 并修改方法dottedLineMove
中对x
和y
赋值的地方:
const topPx = this.verticalDottedTop + "px"; this.hStyle = { top: topPx };
const leftPx = this.horizontalDottedLeft + "px"; this.lStyle = { left: leftPx };
然后 就可以了.
我的Vue版本是2.6.10, 感觉像是兼容性问题.
Metadata
Metadata
Assignees
Labels
No labels