-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Add clearable to el-input #8509
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
Conversation
</script> | ||
``` | ||
::: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add clearable
in the Input Attribute
table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any order preference? Should I add it to the end of the attribute list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'm thinking it would be nice to have attribute / slot / event lists ordered alphabetically (at least for en-US). Would you support a PR for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the order of items is insignificant now, you can append to the list.
Alphabetical order may not be a good idea. I think it's better to group items by their features.
For example: prefix-icon
, suffix-icon
should stay together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I appended it to the list.
packages/input/src/input.vue
Outdated
clear() { | ||
this.$emit('input', ''); | ||
this.setCurrentValue(''); | ||
this.focus(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, everything looks good to me, except that after clearing the input, the change
event should trigger. Here we should add
this.$emit('change', '');
examples/docs/en-US/input.md
Outdated
<el-input | ||
placeholder="Please input" | ||
v-model="input10" | ||
:clearable="true"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer clearable
shorthand here.
@Leopoldthecoder Hey, I see this was released in the new version and it's live on |
@lbogdan Sorry I forgot about that. Will add it soon. |
Adds
clearable
prop to el-input. When set totrue
, if the input is not empty and it's focused or hovered, it shows a clear icon, which, when clicked, clears the input.Resolves #8469.
dev
branch.