diff --git a/packages/core/src/icon/index.ts b/packages/core/src/icon/index.ts index 83b8217..980bac5 100644 --- a/packages/core/src/icon/index.ts +++ b/packages/core/src/icon/index.ts @@ -29,6 +29,8 @@ export const iconProps = defineHookProps({ export type HiIconProps = typeof iconProps; +const isSvg = (src: string) => src.endsWith(".svg") || src.startsWith("data:image/svg+xml"); + export const useIcon = defineHookComponent({ props: iconProps, setup(props, context) { @@ -49,7 +51,7 @@ export const useIcon = defineHookComponent({ }); const dynamicStyle = computed(() => { - const mask = props.mask === "auto" ? props.src.endsWith(".svg") : props.mask; + const mask = props.mask === "auto" ? isSvg(props.src) : props.mask; if (!mask) { return { "background-image": "var(--icon-url)",