Skip to content

Commit

Permalink
fix(upload): fix show-preview-button not working (tusen-ai#1238)
Browse files Browse the repository at this point in the history
  • Loading branch information
kev1nzh committed Sep 28, 2021
1 parent d2401fc commit b8ba892
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Fix `n-data-table` ellipsis not show when last column not set ellipsis, closes [#934](https://github.com/TuSimple/naive-ui/issues/934).
- Fix `n-grid-item` won't work with responsive config.
- Fix `n-tabs`'s scroll shadow is not updated when it's resized, closes [#1224](https://github.com/TuSimple/naive-ui/issues/1224).
- Fix `n-upload`'s `show-preview-button` prop not working,closes [#1238](https://github.com/TuSimple/naive-ui/issues/1238)

### Feats

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- 修复 `n-data-table` 当最后一列未设置 `ellipsis` 时省略失效,关闭 [#934](https://github.com/TuSimple/naive-ui/issues/934)
- 修复 `n-grid-item` 响应式不生效
- 修复 `n-tabs` 在尺寸改变后没有更新滚动阴影状态,关闭 [#1224](https://github.com/TuSimple/naive-ui/issues/1224)
- 修复 `n-upload``show-preview-button` 属性失效,关闭 [#1238](https://github.com/TuSimple/naive-ui/issues/1238)

### Feats

Expand Down
4 changes: 2 additions & 2 deletions src/upload/src/Upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ const uploadProps = {
type: Boolean,
default: true
},
showPreivewButton: {
showPreviewButton: {
type: Boolean,
default: true
},
Expand Down Expand Up @@ -492,7 +492,7 @@ export default defineComponent({
XhrMap,
submit,
doChange,
showPreivewButtonRef: toRef(props, 'showPreivewButton'),
showPreviewButtonRef: toRef(props, 'showPreviewButton'),
onPreviewRef: toRef(props, 'onPreview'),
getFileThumbnailUrl,
listTypeRef: toRef(props, 'listType'),
Expand Down
8 changes: 4 additions & 4 deletions src/upload/src/UploadFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ export default defineComponent({
const { file } = props
return ['error'].includes(file.status)
})
const showPreivewButtonRef = computed(() => {
if (!NUpload.showPreivewButtonRef.value) return false
const showPreviewButtonRef = computed(() => {
if (!NUpload.showPreviewButtonRef.value) return false
const {
file: { status, url },
listType
Expand Down Expand Up @@ -194,7 +194,7 @@ export default defineComponent({
showRemoveButton: showRemoveButtonRef,
showDownloadButton: showDownloadButtonRef,
showRetryButton: showRetryButtonRef,
showPreivewButton: showPreivewButtonRef,
showPreviewButton: showPreviewButtonRef,
thumbnailUrl: thumbnailUrlRef,
imageRef,
handleRemoveOrCancelClick,
Expand Down Expand Up @@ -303,7 +303,7 @@ export default defineComponent({
`${clsPrefix}-upload-file-info__action--${listType}-type`
]}
>
{this.showPreivewButton ? (
{this.showPreviewButton ? (
<NButton
key="preview"
text
Expand Down
2 changes: 1 addition & 1 deletion src/upload/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export interface UploadInjection {
onDownloadRef: Ref<OnDownload | undefined>
XhrMap: Map<string, XMLHttpRequest>
doChange: DoChange
showPreivewButtonRef: Ref<boolean>
showPreviewButtonRef: Ref<boolean>
onPreviewRef: Ref<OnPreview | undefined>
listTypeRef: Ref<listType>
dragOverRef: Ref<boolean>
Expand Down

0 comments on commit b8ba892

Please sign in to comment.