Skip to content
This repository was archived by the owner on Dec 8, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/react/src/runtime/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ export interface IIconConfig {
innerFillColor: string;
};
};

// 唯一ID 生成函数
guid?: () => string,
}

// 图标基础属性
Expand Down Expand Up @@ -232,7 +235,10 @@ export function IconWrapper(name: string, rtl: boolean, render: IconRender): Ico

const ICON_CONFIGS = useContext(IconContext);

const id = useMemo(guid, []);
let id = guid();
if (ICON_CONFIGS.guid && typeof ICON_CONFIGS.guid == 'function') {
id = ICON_CONFIGS.guid();
}

const svgProps = IconConverter(id, {
size,
Expand Down
10 changes: 8 additions & 2 deletions packages/vue-next/src/runtime/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ export interface IIconConfig {
innerFillColor: string;
};
};

// 唯一ID 生成函数
guid?: () => string,
}

// 图标基础属性
Expand Down Expand Up @@ -218,10 +221,13 @@ export function IconWrapper(name: string, rtl: boolean, render: IconRender): Ico
props: ['size', 'strokeWidth', 'strokeLinecap', 'strokeLinejoin', 'theme', 'fill', 'spin'],
setup: (props) => {

const id = guid();

const ICON_CONFIGS = inject(IconContext, DEFAULT_ICON_CONFIGS);

let id = guid();
if (ICON_CONFIGS.guid && typeof ICON_CONFIGS.guid == 'function') {
id = ICON_CONFIGS.guid();
}

return () => {

const {
Expand Down