Files
wehub-resource-sync 2114b14ee0
Sync main into demo / sync (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:26 +08:00

20 lines
640 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import React from 'react';
import { AsyncFsImage } from '../../../os/components/AsyncFsImage';
/**
* 微信内统一图片渲染:
* - /sdcard/*:走系统文件系统(支持 IndexedDB 文件 -> Blob URL
* - 其他:按普通 <img> 处理(如 base64 dataUrl / 站内静态资源)
*/
export const WechatSmartImage: React.FC<{
src: string;
className?: string;
alt?: string;
}> = ({ src, className, alt }) => {
if (src.startsWith('/sdcard/')) {
return <AsyncFsImage path={src} fallbackSrc={src} className={className} alt={alt} />;
}
return <img src={src} className={className} alt={alt} loading="lazy" />;
};