Skip to content

fix(isImg): 修复创建<LazyIcon>组件时,使用的isImg方法未检测图片资源是否为base64编码的问题 #301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

Stan-BK
Copy link

@Stan-BK Stan-BK commented Mar 19, 2025

问题表述:

在开启了Vite的构建选项assetInlineLimit时,小文件会被内联为base64编码,而原先<LazyIcon>组件使用的isImg工具函数在判断资源路径是否为图片类型时忽略了base64编码,这会导致小文件图片资源以base64编码进行内联时,组件创建异常的问题。

解决方法

添加对于base64编码图片资源的识别,直接将其创建为img元素。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant