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
[Bug Report] [Component] [input] clearable 会动态改变宽度 #7287
[Bug Report] [Component] [input] clearable 会动态改变宽度 #7287
Comments
你好~ 因为你的代码中el-input是没有宽度的, |
我知道怎么解决,但是在之前的版本里是没有这个问题的。 |
Maybe it is caused by #7179 Can you have a look? The solution I can think of is to add a default width to the container, but I'm not sure if this creates additional issues. |
对于clearable或者可以使用绝对定位去解决,其他继续沿用flex布局 ? |
clearable 应该还需要对 suffix 等情况进行判断,以及设置输入框的可显示宽度,可能也比较麻烦。 |
改成绝对定位,就需要动态计算,比较麻烦而且很容易出现问题。之所以改成 flex 布局,就是为了解决开发者指定多个 suffix、prefix 时的布局问题。
其他组件库默认给了 clearable 占位,但那样默认情况下右侧的留白就会显得比较大,和左侧也不对称,不是很美观。前几天在 discord 讨论过,暂时还想不出好的解决办法。 |
为 input container 设置默认宽度是否存在潜在问题?@plainheart |
@YunYouJun 我觉得还是不要默认设置宽度 个人感觉大多数情况下开发者可能更喜欢默认填充父级宽度 而且加了默认宽度也算是一个小的 BC 了。 |
现在的 input 似乎因为浏览器默认 input 会有一个默认宽度,并导致拥有 clearable 等 suffix 元素时改变其宽度。 cc @JeremyWuuuuu |
感觉直接可以给一个最小宽度 220px (--el-date-editor-width)? 类似的还有在 el-form inline 中使用 Slider 由于没有最小宽度直接就是一个圆圈。 为 |
这个问题好像好久没动静了,我看了一遍,也是比较赞同不添加默认宽度,如果没有很好的解决办法,可能要舍弃掉美观这块,采用flex布局。 |
显示隐藏时的宽度可能另一个问题. 可以考虑把这个Hover时显示隐藏Clearable的功能拿掉吗 这功能在视觉上造成了视觉不一致, 主要有下面两种情况
|
…s#7287) fix(components): [input] input width change by clearable (element-plus#7287)
In version 2.2.17, use currentPage can't bind variable to current page. fix(components): [input] input width change by clearable (element-plus#7287)
…s#7287) fix(components): [input] input width change by clearable (element-plus#7287) fix(components): [input] input width change by clearable (element-plus#7287)
…s#7287) fix(components): [input] input width change by clearable (element-plus#7287) fix(components): [input] input width change by clearable (element-plus#7287)
…s#7287) fix(components): [input] input width change by clearable (element-plus#7287) fix(components): [input] input width change by clearable (element-plus#7287) fix(components): [input] input width change by clearable (element-plus#7287)
…s#7287) fix(components): [input] input width change by clearable (element-plus#7287) fix(components): [input] input width change by clearable (element-plus#7287) fix(components): [input] input width change by clearable (element-plus#7287)
…s#7287) fix(components): [input] input width change by clearable (element-plus#7287) fix(components): [input] input width change by clearable (element-plus#7287) fix(components): [input] input width change by clearable (element-plus#7287)
这个问题太影响使用体验了。无论是定位还是占位感觉都比现在的这个方案合适。 |
咱就是说,之前饿了么2都没有这个问题的,到3这样用起来真的很不爽,为什么不考虑在form inline模式下给个默认定宽呢 |
能不能做个input有值的情况下长期显示clearable的图标的API? |
是否可添加attributes, 让使用者自行决定使用何种方案? |
为 form inline 模式下的 input 增加默认宽度或许是比较合适的主意 |
Let's do it? |
agree |
还没商量出一个方案吗? 确定下来咔咔先整了再说 |
注意,给 el-input 指定宽度后 220px (--el-date-editor-width)?,会导致手动指定宽度的 el-select 显示异常 @tolking |
所以路过讨论一下,最后是怎么处理了...全局加默认宽度吗 |
添加默认宽度后,在复用 input 的 select 等多种组件将遇到其他问题,这使得情况更加复杂且难以复用。 并在文档中针对当前问题给出解决方案提示。 |
…s#7287) fix(components): [input] input width change by clearable (element-plus#7287) fix(components): [input] input width change by clearable (element-plus#7287) fix(components): [input] input width change by clearable (element-plus#7287)
不想设置宽度的可以试试,希望官方早点解决 |
Bug Type:
Component
Environment
3.2.31
2.1.10
chrome 99.0.4844.82
Vite
Reproduction
Related Component
el-input
Reproduction Link
Element Plus Playground
Steps to reproduce
在表单组件下,input组件增加clearable属性,input组件宽度会动态变化
What is Expected?
不会变化宽度
What is actually happening?
宽度动态变化
Additional comments
(empty)
The text was updated successfully, but these errors were encountered: