diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..3c409a1a --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "printWidth": 90, + "singleQuote": true, + "trailingComma": "none" +} diff --git a/packages/uploader/index.ts b/packages/uploader/index.ts index 26102cd7..3bc81240 100644 --- a/packages/uploader/index.ts +++ b/packages/uploader/index.ts @@ -175,17 +175,12 @@ VantComponent({ }, onPreviewImage(event) { + if (!this.data.previewFullImage) return; + const { index } = event.currentTarget.dataset; const { lists } = this.data; const item = lists[index]; - this.$emit('click-preview', { - url: item.url || item.path, - ...this.getDetail(index), - }); - - if (!this.data.previewFullImage) return; - wx.previewImage({ urls: lists .filter((item) => item.isImage) @@ -196,5 +191,15 @@ VantComponent({ }, }); }, + + onClickPreview(event) { + const { index } = event.currentTarget.dataset; + const item = this.data.lists[index]; + + this.$emit('click-preview', { + ...item, + ...this.getDetail(index), + }); + }, }, }); diff --git a/packages/uploader/index.wxml b/packages/uploader/index.wxml index 417fb85e..9abcf47b 100644 --- a/packages/uploader/index.wxml +++ b/packages/uploader/index.wxml @@ -5,9 +5,11 @@ - + {{ item.message }}