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

label名称长度问题 #46

Closed
H-Sven opened this issue Apr 17, 2019 · 2 comments
Closed

label名称长度问题 #46

H-Sven opened this issue Apr 17, 2019 · 2 comments

Comments

@H-Sven
Copy link

H-Sven commented Apr 17, 2019

作者在源码中将witdh 写死在了160px 导致如果label长度大于160 会被忽略掉,我将你的源码中这段css删除后可以正常显示完成的label了,但是发现当展开三级之后,还是会因为label过长导致样式错位
后来发现您源码中动态改变菜单宽度的代码
// 改变菜单宽度 setPopperWidth() { let width = (160 + 1) * this.casTree.length; document.getElementsByClassName(this.classRef)[0].style.width = width + "px"; }

源码中 设置了 .cascader-popper {width:100%}

我尝试将这些代码删除,解决了这个问题

不知道作者当初设置这些代码的原因是什么
这里依然是基于160 * 子菜单个数算的,这依然限制了面板的长度,导致错位了,请问作者对这个问题怎么解决
Snipaste_2019-04-17_14-37-57

@H-Sven
Copy link
Author

H-Sven commented Apr 17, 2019

建议删除 main.vue 中的

setPopperWidth() {
      let width = (160 + 1) * this.casTree.length;
      let el = document.getElementsByClassName(this.classRef)[0];
      if(el){
        el.style.width = width + "px";
      }
    }
.cascader-popper {
  width: 100%;
}
.cascader-menu {
  width: 160px !important;
}

@webCoderJ
Copy link
Owner

已经修复,可更新使用

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

2 participants