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

fix(upload): 上传组件图片展示样式优化 #4853

Merged
merged 2 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,4 @@ exports[`DatePicker > :value 1`] = `
<!---->
</div>
</div>
`;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,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"
referrerpolicy="strict-origin-when-cross-origin"
src=""
/>
Expand Down Expand Up @@ -1308,7 +1308,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"
referrerpolicy="strict-origin-when-cross-origin"
src="https://img1.txt"
/>
Expand Down Expand Up @@ -1425,7 +1425,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"
referrerpolicy="strict-origin-when-cross-origin"
src="https://img2.txt"
/>
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 @@ -66,7 +66,7 @@ export default defineComponent({
const renderMainContent = (file: UploadFile, index: number) => {
return (
<div class={`${classPrefix.value}-upload__card-content ${classPrefix.value}-upload__card-box`}>
<Image class={`${classPrefix.value}-upload__card-image`} src={file.url || file.raw} error="" />
<Image class={`${classPrefix.value}-upload__card-image`} src={file.url || file.raw} error="" fit="contain" />
<div class={`${classPrefix.value}-upload__card-mask`}>
<span class={`${classPrefix.value}-upload__card-mask-item`} onClick={(e) => 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 @@ -173,7 +173,13 @@ export default defineComponent({
</div>
)}
{(['waiting', 'success'].includes(file.status) || (!file.status && file.url)) && (
<Image class={`${uploadPrefix.value}__card-image`} src={file.url || file.raw} error="" loading="" />
<Image
class={`${uploadPrefix.value}__card-image`}
src={file.url || file.raw}
error=""
loading=""
fit="contain"
/>
)}
<div class={`${uploadPrefix.value}__card-mask`}>
{(file.url || file.raw) && !['progress', 'fail'].includes(file.status) && (
Expand Down
10 changes: 5 additions & 5 deletions test/unit/snap/__snapshots__/csr.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -64662,7 +64662,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"
referrerpolicy="strict-origin-when-cross-origin"
src="https://tdesign.gtimg.com/site/avatar.jpg"
/>
Expand Down Expand Up @@ -198237,7 +198237,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"
referrerpolicy="strict-origin-when-cross-origin"
src="https://tdesign.gtimg.com/demo/demo-image-1.png"
/>
Expand Down Expand Up @@ -198625,7 +198625,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"
referrerpolicy="strict-origin-when-cross-origin"
src="https://tdesign.gtimg.com/demo/demo-image-1.png"
/>
Expand Down Expand Up @@ -198884,7 +198884,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"
referrerpolicy="strict-origin-when-cross-origin"
src="https://tdesign.gtimg.com/demo/demo-image-1.png"
/>
Expand Down Expand Up @@ -199001,7 +199001,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"
referrerpolicy="strict-origin-when-cross-origin"
src="https://tdesign.gtimg.com/demo/demo-image-1.png"
/>
Expand Down
Loading
Loading