fix(isImg): 修复创建<LazyIcon>
组件时,使用的isImg
方法未检测图片资源是否为base64编码的问题
#301
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
问题表述:
在开启了Vite的构建选项
assetInlineLimit
时,小文件会被内联为base64编码,而原先<LazyIcon>
组件使用的isImg
工具函数在判断资源路径是否为图片类型时忽略了base64编码,这会导致小文件图片资源以base64编码进行内联时,组件创建异常的问题。解决方法
添加对于base64编码图片资源的识别,直接将其创建为
img
元素。