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

[Bug Report] [Component] [input] input加了clearable属性后输入内容宽度会发生变化!失去焦点恢复原始宽度,获取焦点又会宽度改变 #8411

Closed
lait233 opened this issue Jun 22, 2022 · 7 comments
Labels

Comments

@lait233
Copy link

lait233 commented Jun 22, 2022

Bug Type: Component

Environment

  • Vue Version: 3.2.37
  • Element Plus Version: 2.2.6
  • Browser / OS: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36
  • Build Tool: CDN

Reproduction

Related Component

  • el-input

Reproduction Link

Element Plus Playground

Steps to reproduce

点击复现连接即可看到
在中文名称input输入内容然后失去焦点。然后在获取焦点就会变形

What is Expected?

input宽度不变形

What is actually happening?

input加了clearable属性就会变形

Additional comments

(empty)

element-input-bug

@tolking
Copy link
Member

tolking commented Jun 22, 2022

It is recommended to set a min-width or width for the Input component.

reference #7287

@skychf
Copy link

skychf commented Jul 13, 2022

是有这样的问题,体验不是很好, 建议宽度不要改变!(设置宽度也是不行的)

@tuutoo
Copy link

tuutoo commented Jul 13, 2022

今天我也发现了这问题. 原因是我的文本并不是左对齐, 而是居中对齐的. 然后你会发现鼠标移入和移出的时候, 文本就在那左右跳.
建议只要是输入框有文本的时候, 就一直显示这个删除按钮. 不要在Hover的时候来回显示的...不需要这样.

可以参考AntD vue和Vuetify的输入框, 都是这样的.

https://antdv.com/components/input-cn#components-input-demo-allow-clear
https://vuetifyjs.com/zh-Hans/components/text-fields/#section-53ef6e059664

@chenxch
Copy link
Member

chenxch commented Jul 13, 2022

今天我也发现了这问题. 原因是我的文本并不是左对齐, 而是居中对齐的. 然后你会发现鼠标移入和移出的时候, 文本就在那左右跳. 建议只要是输入框有文本的时候, 就一直显示这个删除按钮. 不要在Hover的时候来回显示的...不需要这样.

可以参考AntD vue和Vuetify的输入框, 都是这样的.

https://antdv.com/components/input-cn#components-input-demo-allow-clear https://vuetifyjs.com/zh-Hans/components/text-fields/#section-53ef6e059664

hover这个应该是组件库交互设计上的差异,我认为主要的问题点应该是在目前我们的clearable不是采用flex布局导致的。

@zcf0508
Copy link

zcf0508 commented Aug 4, 2022

Same problem.

@HeftyKoo
Copy link
Member

Duplicate: #7287

@itum-git
Copy link

itum-git commented Feb 14, 2023

主要原因是input外部缺少固定宽度的容器,这个问题比较棘手,可能官方也没有好的处理方式,可以使用栅格布局,用<el-row><el-col>包裹<el-form-item>,这样就不用担心宽度的变化

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants