+
Skip to content

style绑定的一个问题 #16

Open
@TheNowWJJ

Description

@TheNowWJJ

我用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, 感觉像是兼容性问题.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载