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

refactor[tooltip] 新增鼠标悬浮弹层不消失功能 #54

Merged
merged 3 commits into from
Aug 1, 2019

Conversation

lihaijietju
Copy link
Contributor

新增鼠标悬浮弹层不消失功能

@y8n
Copy link
Contributor

y8n commented Jul 30, 2019

自动化测试没跑通过,自行检查一下

triggers = getTriggers(val);

if (triggers.show !== 'none') {
triggers.show.forEach(function (trigger, idx) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trigger.show的类型是什么?从getTrigger方法看,应该是数组吧,为什么会判断!== 'none'

Copy link
Contributor Author

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有移除事件

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

移除时间在下面
image


if (triggers.show !== 'none') {
triggers.show.forEach(function (trigger, idx) {
if (trigger !== triggers.hide[idx]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里没太看懂,指的是当显示的trigger不等于隐藏的trigger时进行下面的逻辑,为什么有这样的判断呢?

Copy link
Contributor Author

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) {
Copy link
Contributor

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呢

@y8n y8n merged commit b1e37db into xgfe:dev Aug 1, 2019
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

Successfully merging this pull request may close these issues.

2 participants