diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 8acd9c106..99c3ec9d9 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -14,6 +14,7 @@ - Fix `n-message`'s `destroyAll` method doesn't work. - Fix `n-timeline`'s header slot is invalid when using alone. - Fix `n-select` incorrect style when props has `disabled` and `filterable`, closes [#698](https://github.com/TuSimple/naive-ui/issues/698). +- Fix `n-upload` operation buttons displayed when has `file-list` & `disabled` props, closes [#668](https://github.com/TuSimple/naive-ui/issues/668). ## 2.15.9 (2021-07-28) diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 6d4bf7156..a17647ea5 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -14,6 +14,7 @@ - 修复 `n-message` 的 `destroyAll` 方法不生效 - 修复 `n-timeline` 的 header slot 单独使用无效的问题 - 修复 `n-select` 当属性是 `disabled` 和 `filterable` 时样式错误, 关闭 [#698](https://github.com/TuSimple/naive-ui/issues/698) +- 修复 `n-upload` 拥有 `file-list` & `disabled` 属性时操作按钮仍然显示,关闭 [#668](https://github.com/TuSimple/naive-ui/issues/668) ## 2.15.9 (2021-07-28) diff --git a/src/upload/src/Upload.tsx b/src/upload/src/Upload.tsx index 98f9af0cc..b32af9612 100644 --- a/src/upload/src/Upload.tsx +++ b/src/upload/src/Upload.tsx @@ -415,6 +415,7 @@ export default defineComponent({ provide(uploadInjectionKey, { mergedClsPrefixRef, mergedThemeRef: themeRef, + disabledRef: toRef(props, 'disabled'), showCancelButtonRef: toRef(props, 'showCancelButton'), showDownloadButtonRef: toRef(props, 'showDownloadButton'), showRemoveButtonRef: toRef(props, 'showRemoveButton'), diff --git a/src/upload/src/UploadFile.tsx b/src/upload/src/UploadFile.tsx index 3a50e263a..82f0c1761 100644 --- a/src/upload/src/UploadFile.tsx +++ b/src/upload/src/UploadFile.tsx @@ -126,6 +126,7 @@ export default defineComponent({ progressStatus: progressStatusRef, buttonType: buttonTypeRef, showProgress: showProgressRef, + disabled: NUpload.disabledRef, showCancelButton: showCancelButtonRef, showRemoveButton: showRemoveButtonRef, showDownloadButton: showDownloadButtonRef, @@ -156,7 +157,8 @@ export default defineComponent({ {this.file.name}
- {this.showRemoveButton || this.showCancelButton ? ( + {(this.showRemoveButton || this.showCancelButton) && + !this.disabled ? ( - ) : null} - {this.showRetryButton ? ( + ) : null} + {this.showRetryButton && !this.disabled ? ( void export interface UploadInjection { mergedClsPrefixRef: Ref mergedThemeRef: Ref> + disabledRef: Ref showCancelButtonRef: Ref showRemoveButtonRef: Ref showDownloadButtonRef: Ref diff --git a/src/upload/src/styles/index.cssr.ts b/src/upload/src/styles/index.cssr.ts index 5a0e17a14..0d9e4a2ab 100644 --- a/src/upload/src/styles/index.cssr.ts +++ b/src/upload/src/styles/index.cssr.ts @@ -145,7 +145,7 @@ export default cB('upload', [ cE('trigger', ` cursor: not-allowed; `), - cB('upload-file-list', ` + cB('upload-file', ` cursor: not-allowed; `), cB('upload-dragger', `