fix:优化前端图片展示添加默认图片

This commit is contained in:
jiangrui
2025-03-12 15:23:11 +08:00
parent bc38acded3
commit bf2d7c70c7
7 changed files with 32 additions and 46 deletions

View File

@@ -0,0 +1,10 @@
import { useUserSettingStore } from "@/stores/userSetting";
import defaultImage from "@/assets/images/default.png";
export const getProxyImageUrl = (originalUrl: string): string => {
const userStore = useUserSettingStore();
if (!originalUrl) return defaultImage;
return userStore.imagesSource === "proxy"
? `/tele-images/?url=${encodeURIComponent(originalUrl)}`
: originalUrl;
};