Skip to content

Commit

Permalink
feat: exclude template tag to support jsx-directive (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiyuanzmj authored Sep 2, 2024
1 parent 180a6ca commit 64cbb2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/compiler/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export async function compileSFCTemplate(

babelTraverse(ast, {
enter({ node }) {
if (node.type === 'JSXElement') {
if (node.type === 'JSXElement' && !EXCLUDE_TAG.includes(s.slice(node.openingElement.name.start, node.openingElement.name.end))) {
if (node.openingElement.attributes.some(attr => attr.type !== 'JSXSpreadAttribute' && attr.name.name === KEY_DATA,
))
return
Expand Down
7 changes: 6 additions & 1 deletion packages/playground/vue3/src/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ export default defineComponent({
name: 'Welcome',
setup() {
const text = 'Welcome to here 🚀 .'
return () => <p style={{ color: '#fcb80f', cursor: 'pointer' }}> {text} </p>
return () => (
<p style={{ color: '#fcb80f', cursor: 'pointer' }}>
{text}
<template v-if={text}>{text}</template>
</p>
)
},
})

0 comments on commit 64cbb2d

Please sign in to comment.