mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-01-12 08:08:46 +08:00
fix:优化前端图片展示添加默认图片
This commit is contained in:
10
frontend/src/utils/image.ts
Normal file
10
frontend/src/utils/image.ts
Normal 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;
|
||||
};
|
||||
Reference in New Issue
Block a user