perf: 优化用户管理-裁剪图片上传功能 (#1027)

* perf: 优化用户管理-裁剪图片上传功能
This commit is contained in:
ZM25XC 2024-03-25 14:57:10 +08:00 committed by GitHub
parent e38610ff67
commit bc1da0b759
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,6 +6,7 @@ import { zxcvbn } from "@zxcvbn-ts/core";
import { handleTree } from "@/utils/tree";
import { message } from "@/utils/message";
import croppingUpload from "../upload.vue";
import userAvatar from "@/assets/user.jpg";
import { usePublicHooks } from "../../hooks";
import { addDialog } from "@/components/ReDialog";
import type { PaginationProps } from "@pureadmin/table";
@ -85,8 +86,8 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
<el-image
fit="cover"
preview-teleported={true}
src={row.avatar}
preview-src-list={Array.of(row.avatar)}
src={row.avatar || userAvatar}
preview-src-list={Array.of(row.avatar || userAvatar)}
class="w-[24px] h-[24px] rounded-full align-middle"
/>
),
@ -370,7 +371,7 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
contentRenderer: () =>
h(croppingUpload, {
ref: cropRef,
imgSrc: row.avatar,
imgSrc: row.avatar || userAvatar,
onCropper: info => (avatarInfo.value = info)
}),
beforeSure: done => {