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

feat(components): [input] add prefix, suffix, prepend and append props for simple plain text. #16516

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

drylint
Copy link
Contributor

@drylint drylint commented Apr 15, 2024

Please make sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow contributing guide English | (中文 | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer to relative issues for your PR.

At present, <el-input> supports prefix, suffix, prepend and append slots, it's useful to insert something into <el-input> components.

But in many times, we might just want to insert a plain text, like <el-dialog> accept title prop and header (called title before) slot, we can use title prop for plain text, and use header slot to render complex content.

So, added these props the same name with the slot, and the slot has a higher priority.

<!-- use slots -->
<el-input
  v-model="inputValue"
  placeholder="Please input"
>
  <template #prepend>Http://</template>
  <template #append>.com</template>
</el-input>

<!-- use props -->
<el-input
  v-model="inputValue"
  placeholder="Please input"
  prepend="Http://"
  append=".com"
/>

In addition, use an Array of object to render a form list via v-for directive, it's convenient to pass prefix, suffix, prepend and append as a property of a object to render plain text.

Copy link

👋 @drylint, thank you for contributing element-plus.

  • You can comment with /label Components:[component_name] to add a label for which component you are working on.
  • You may join our Discord for staying tuned.

Copy link

github-actions bot commented Apr 15, 2024

Copy link

Hello @drylint, thank you for contributing to element-plus, please see our guideline to see how to make contribution

Copy link

🧪 Playground Preview: https://element-plus.run/?pr=16516
Please comment the example via this playground if needed.

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

Successfully merging this pull request may close these issues.

None yet

1 participant