-
Notifications
You must be signed in to change notification settings - Fork 18
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
refactor[tooltip] 新增鼠标悬浮弹层不消失功能 #54
Conversation
自动化测试没跑通过,自行检查一下 |
triggers = getTriggers(val); | ||
|
||
if (triggers.show !== 'none') { | ||
triggers.show.forEach(function (trigger, idx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trigger.show
的类型是什么?从getTrigger方法看,应该是数组吧,为什么会判断!== 'none'
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个跟split的都是之前的判断逻辑,没看太懂,也就没敢动这块的逻辑,直接拿来用的
if (triggers.show !== 'none') { | ||
triggers.show.forEach(function (trigger, idx) { | ||
if (trigger !== triggers.hide[idx]) { | ||
tooltip[0].addEventListener(trigger, showTooltipBind); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没有移除事件
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
if (triggers.show !== 'none') { | ||
triggers.show.forEach(function (trigger, idx) { | ||
if (trigger !== triggers.hide[idx]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里没太看懂,指的是当显示的trigger不等于隐藏的trigger时进行下面的逻辑,为什么有这样的判断呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不等于隐藏trigger的情况分以下两种种:mouseenter,focus,当这两者时候,才需要加显示弹层的事件,其它情况比如click和outsideClick不需要
triggers.show.forEach(function (trigger, idx) { | ||
if (trigger !== triggers.hide[idx]) { | ||
tooltip[0].addEventListener(trigger, showTooltipBind); | ||
triggers.hide[idx].split(' ').forEach(function (trigger) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
triggers.hide[idx]
已经是一个trigger了吧,为什么还要split呢
新增鼠标悬浮弹层不消失功能