fix: mobile icon build error

This commit is contained in:
sealday 2024-04-10 17:08:40 +08:00
parent 06ac4f04c4
commit 35310f7532

View File

@ -5,9 +5,12 @@ import NoticeSvg from './notice.svg';
import SwiperSvg from './swiper.svg'; import SwiperSvg from './swiper.svg';
import TabSearchSvg from './tab-search.svg'; import TabSearchSvg from './tab-search.svg';
export const loadBase64Icon = (base64: string) => () => ( let convert = (encoded: string) => decodeURI(encoded).replace('data:image/svg+xml,', '');
<div dangerouslySetInnerHTML={{ __html: atob(base64.replace('data:image/svg+xml;base64,', '')) }} /> if (process.env.NODE_ENV !== 'production') {
); convert = (encoded: string) => atob(encoded.replace('data:image/svg+xml;base64,', ''));
}
export const loadBase64Icon = (encoded: string) => () => <div dangerouslySetInnerHTML={{ __html: convert(encoded) }} />;
export const NoticeIcon = (props: any) => <Icon component={loadBase64Icon(NoticeSvg)} {...props} />; export const NoticeIcon = (props: any) => <Icon component={loadBase64Icon(NoticeSvg)} {...props} />;
export const SwiperIcon = (props: any) => <Icon component={loadBase64Icon(SwiperSvg)} {...props} />; export const SwiperIcon = (props: any) => <Icon component={loadBase64Icon(SwiperSvg)} {...props} />;