Skip to content

Commit

Permalink
fix: 转换JSX语法时,如果是JS匿名函数会导致转换失败
Browse files Browse the repository at this point in the history
  • Loading branch information
gene9831 committed Apr 23, 2024
1 parent eaa3c57 commit 347ab91
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/canvas/src/components/render/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ const transformJSX = (code) => {
const result = replaceCode(res.code || '')
if (result.startsWith('(')) {
const index = result.lastIndexOf(')')
return result.slice(1, index).concat(result.slice(index + 1))
return result
.slice(1, index)
.concat(result.slice(index + 1))
.trim()
}
return result.trim()
return result
}
}

Expand Down

0 comments on commit 347ab91

Please sign in to comment.