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

Optimizing the click sensitivity of dashboard's side bar menu #268

Merged
merged 3 commits into from
Nov 29, 2018

Conversation

cdfive
Copy link
Collaborator

@cdfive cdfive commented Nov 28, 2018

Describe what this PR does / why we need it

经测试,控制台左边菜单有不灵敏问题,偶尔出现点击2次才能展开;
复现步骤:
启动控制台,在左边菜单栏点击某个应用,单击中间文字展开,再单击折叠;
然后对准文字右边的向下箭头单击,可能多单击几次,会出现菜单无法展开的情况;
如果有多个应用,点击文字或者箭头展开折叠,多次点击如果点到了箭头也现该情况,
导致主观感觉上有时需要点一下,有时点两下。

Does this pull request fix one issue?

Fixes #245

Describe how you did it

查看sidebar.js的代码,发现里面折叠其它应用菜单的时候,用了element jquery语法,
element.parent().children('ul').hide()
而sidebar.html中向下箭头相对于菜单文字多了一个层级,如果用parent()加判断不方便;
经向前端同学咨询并查阅了些资料,angular支持数据双向绑定,不推荐直接操作dom;
尝试修改代码,直接遍历修改item.active的值。

参考:
AngularJS折叠菜单实现方法示例 https://www.jb51.net/article/114004.htm
Angular中直接操作DOM https://www.jianshu.com/p/fddd81926e5d

Describe how to verify it

本机启动应用以及在开发、生产环境、按复现步骤多次点击菜单,展开折叠没有出现点两次的情况。

Special notes for reviews

@codecov-io
Copy link

Codecov Report

Merging #268 into master will increase coverage by 0.58%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #268      +/-   ##
============================================
+ Coverage     49.83%   50.42%   +0.58%     
- Complexity      915      922       +7     
============================================
  Files           158      158              
  Lines          5259     5259              
  Branches        757      757              
============================================
+ Hits           2621     2652      +31     
+ Misses         2306     2262      -44     
- Partials        332      345      +13
Impacted Files Coverage Δ Complexity Δ
...a/csp/sentinel/slots/statistic/base/LeapArray.java 58.57% <0%> (-7.15%) 17% <0%> (-2%)
...a/csp/sentinel/slots/statistic/base/LongAdder.java 31.91% <0%> (+14.89%) 10% <0%> (+6%) ⬆️
...a/csp/sentinel/slots/statistic/base/Striped64.java 56.25% <0%> (+30.2%) 8% <0%> (+3%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4f854c9...64dc81c. Read the comment docs.

@sczyh30 sczyh30 added the to-review To review label Nov 28, 2018
Copy link
Member

@sczyh30 sczyh30 left a comment

Choose a reason for hiding this comment

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

LGTM

@sczyh30 sczyh30 merged commit 0bc07f3 into alibaba:master Nov 29, 2018
@sczyh30
Copy link
Member

sczyh30 commented Nov 29, 2018

Nice, thanks for contributing! 👍

@sczyh30 sczyh30 removed the to-review To review label Nov 29, 2018
@sczyh30 sczyh30 added this to the 1.4.0 milestone Nov 30, 2018
Arlmls pushed a commit to Arlmls/Sentinel that referenced this pull request Jan 8, 2019
- Use AngularJS binding model directly rather than jQuery DOM-based operation
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.

控制台左边菜单收缩不灵敏
3 participants