Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style绑定的一个问题 #16

Open
TheNowWJJ opened this issue Sep 9, 2021 · 0 comments
Open

style绑定的一个问题 #16

TheNowWJJ opened this issue Sep 9, 2021 · 0 comments

Comments

@TheNowWJJ
Copy link

我用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 中对xy 赋值的地方:

const topPx = this.verticalDottedTop + "px"; this.hStyle = { top: topPx };

const leftPx = this.horizontalDottedLeft + "px"; this.lStyle = { left: leftPx };

然后 就可以了.

我的Vue版本是2.6.10, 感觉像是兼容性问题.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant