Skip to content

Commit

Permalink
fix: 修复icon组件传入部分svg字符串无法显示问题
Browse files Browse the repository at this point in the history
  • Loading branch information
qkiroc committed Dec 5, 2024
1 parent 7d91c20 commit 89910c5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/amis-ui/src/components/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ export function Icon({

// 直接传入svg字符串
if (typeof icon === 'string' && icon.startsWith('<svg')) {
icon = icon.replace(/\n/g, ' ').replace(/\s+/g, ' ');
const svgStr = /<svg .*?>(.*?)<\/svg>/.exec(icon);
const viewBox = /viewBox="(.*?)"/.exec(icon);
const svgHTML = createElement('svg', {
Expand Down

0 comments on commit 89910c5

Please sign in to comment.