Skip to content

Commit

Permalink
fix(upload): 上传组件图片展示样式优化 (#3429)
Browse files Browse the repository at this point in the history
* fix(upload): 上传组件图片展示样式优化

* chore: update snapshot

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
huangchen1031 and github-actions[bot] authored Dec 20, 2024
1 parent d313fa9 commit 2994ef8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ exports[`Upload Component > props.theme: theme=image-flow works fine 1`] = `
>
<img
alt=""
class="t-image t-image--fit-fill t-image--position-center"
class="t-image t-image--fit-contain t-image--position-center"
src=""
/>
<div
Expand Down Expand Up @@ -984,7 +984,7 @@ exports[`Upload Component > props.theme: theme=image-flow works fine 1`] = `
>
<img
alt=""
class="t-image t-image--fit-fill t-image--position-center"
class="t-image t-image--fit-contain t-image--position-center"
src="https://img1.txt"
/>
<div
Expand Down Expand Up @@ -1087,7 +1087,7 @@ exports[`Upload Component > props.theme: theme=image-flow works fine 1`] = `
>
<img
alt=""
class="t-image t-image--fit-fill t-image--position-center"
class="t-image t-image--fit-contain t-image--position-center"
src="https://img2.txt"
/>
<div
Expand Down
2 changes: 1 addition & 1 deletion src/upload/themes/image-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default defineComponent({
const { BrowseIcon, DeleteIcon } = this.icons;
return (
<div class={`${this.classPrefix}-upload__card-content ${this.classPrefix}-upload__card-box`}>
<Image class={`${this.classPrefix}-upload__card-image`} src={file.url || file.raw} error="" />
<Image class={`${this.classPrefix}-upload__card-image`} src={file.url || file.raw} error="" fit="contain" />
<div class={`${this.classPrefix}-upload__card-mask`}>
<span class={`${this.classPrefix}-upload__card-mask-item`} onClick={(e: MouseEvent) => e.stopPropagation()}>
<ImageViewer
Expand Down
8 changes: 7 additions & 1 deletion src/upload/themes/multiple-flow-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,13 @@ export default defineComponent({
</div>
)}
{(['waiting', 'success'].includes(file.status) || (!file.status && file.url)) && (
<Image class={`${this.uploadPrefix}__card-image`} src={file.url || file.raw} error="" loading="" />
<Image
class={`${this.uploadPrefix}__card-image`}
src={file.url || file.raw}
error=""
loading=""
fit="contain"
/>
)}
<div class={`${this.uploadPrefix}__card-mask`}>
{(file.url || file.raw) && !['progress', 'fail'].includes(file.status) && (
Expand Down
10 changes: 5 additions & 5 deletions test/snap/__snapshots__/csr.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -53539,7 +53539,7 @@ exports[`csr snapshot test > csr test ./src/form/_example/disabled.vue 1`] = `
>
<img
alt=""
class="t-image t-image--fit-fill t-image--position-center"
class="t-image t-image--fit-contain t-image--position-center"
src="https://tdesign.gtimg.com/site/avatar.jpg"
/>
<div
Expand Down Expand Up @@ -136749,7 +136749,7 @@ exports[`csr snapshot test > csr test ./src/upload/_example/image.vue 1`] = `
>
<img
alt=""
class="t-image t-image--fit-fill t-image--position-center"
class="t-image t-image--fit-contain t-image--position-center"
src="https://tdesign.gtimg.com/demo/demo-image-1.png"
/>
<div
Expand Down Expand Up @@ -137050,7 +137050,7 @@ exports[`csr snapshot test > csr test ./src/upload/_example/img-flow-list.vue 1`
>
<img
alt=""
class="t-image t-image--fit-fill t-image--position-center"
class="t-image t-image--fit-contain t-image--position-center"
src="https://tdesign.gtimg.com/demo/demo-image-1.png"
/>
<div
Expand Down Expand Up @@ -137253,7 +137253,7 @@ exports[`csr snapshot test > csr test ./src/upload/_example/img-flow-list.vue 1`
>
<img
alt=""
class="t-image t-image--fit-fill t-image--position-center"
class="t-image t-image--fit-contain t-image--position-center"
src="https://tdesign.gtimg.com/demo/demo-image-1.png"
/>
<div
Expand Down Expand Up @@ -137356,7 +137356,7 @@ exports[`csr snapshot test > csr test ./src/upload/_example/img-flow-list.vue 1`
>
<img
alt=""
class="t-image t-image--fit-fill t-image--position-center"
class="t-image t-image--fit-contain t-image--position-center"
src="https://tdesign.gtimg.com/demo/demo-image-1.png"
/>
<div
Expand Down
Loading

0 comments on commit 2994ef8

Please sign in to comment.