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

[Feature request] disabled or max props for n-upload #1237

Closed
liho98 opened this issue Sep 25, 2021 · 4 comments
Closed

[Feature request] disabled or max props for n-upload #1237

liho98 opened this issue Sep 25, 2021 · 4 comments
Assignees
Labels
feature request New feature or request priority: high

Comments

@liho98
Copy link

liho98 commented Sep 25, 2021

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

hide the upload button when the number of file limit is reached, or disabled the upload button when the number of file limit is reached

Expected API (期望的 API)

<n-upload :max="2" list-type="image-card" /> // will hide the upload button when the number of file limit is reached.

<n-upload :disabled="fileList >=2" list-type="image-card" /> // will disabled the upload button when the number of file limit is reached.

@github-actions github-actions bot added the feature request New feature or request label Sep 25, 2021
@Volankey
Copy link
Collaborator

Try controlled upload https://www.naiveui.com/en-US/os-theme/components/upload#controlled.

 v-model:file-list="fileList"
 :disabled="fileList.length>3"

@liho98
Copy link
Author

liho98 commented Sep 26, 2021

Try controlled upload https://www.naiveui.com/en-US/os-theme/components/upload#controlled.

 v-model:file-list="fileList"
 :disabled="fileList.length>3"

did you tried this code, when disabled is true the opacity of entire file list is BELOW 1, besides doc didnt even mentioned about disabled, however i think both disabled & max props is needed, disabled is to disabled to the upload button, while the max props is for hide the upload button. What do u think?
image

@Volankey
Copy link
Collaborator

@07akioni

@07akioni
Copy link
Collaborator

Add a trigger-disabled prop?

max is needed for uncontrolled mode and it should be related to trigger disabled state.

@kev1nzh37 kev1nzh37 self-assigned this Oct 9, 2021
kev1nzh37 pushed a commit to kev1nzh37/naive-ui that referenced this issue Oct 14, 2021
07akioni added a commit that referenced this issue Oct 17, 2021
* feat(upload): add `max` prop and fix `disabled`'s style  (#1237)

* feat(upload): fix CHANGELOG

* feat(upload): add test

* feat(upload): fix disabled

* Update src/upload/src/Upload.tsx

Co-authored-by: 07akioni <07akioni2@gmail.com>

* feat(upload): fix `upload-dragger` mergedDisabled

Co-authored-by: kev1nzh <kev1nzh@app-ark.com>
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 priority: high
Projects
None yet
Development

No branches or pull requests

4 participants