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

Add "renderIcon" attribute to NButton. #4007

Closed
kvii opened this issue Nov 8, 2022 · 0 comments · Fixed by #4011
Closed

Add "renderIcon" attribute to NButton. #4007

kvii opened this issue Nov 8, 2022 · 0 comments · Fixed by #4011
Labels
feature request New feature or request

Comments

@kvii
Copy link
Contributor

kvii commented Nov 8, 2022

This function solves the problem (这个功能解决的问题)

The following code is a simple demo to create a IconButton.
As you see, even the simplest demo will take 7 lines. It's to boring.

<NButton>
  <template #icon>
    <NIcon>
      <SomeIcon />
    </NIcon>
  </template>
</NButton>

Expected API (期望的 API)

Add a "renderIcon" attribute to NButton.
Then we can write come code like below:

<NButton
  :renderIcon="renderIcon(SomeIcon)"
/>

That makes code clearer and easier to understand.

@github-actions github-actions bot added the feature request New feature or request label Nov 8, 2022
jizai1125 added a commit to jizai1125/naive-ui that referenced this issue Nov 9, 2022
07akioni added a commit that referenced this issue Nov 12, 2022
* feat(button): adds `icon`  prop, closes #4007

* chore: changelog

* refractor: change  to `render-icon` function

Co-authored-by: 07akioni <07akioni2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant