diff --git a/.changeset/dirty-cats-repeat.md b/.changeset/dirty-cats-repeat.md new file mode 100644 index 00000000..db596fc5 --- /dev/null +++ b/.changeset/dirty-cats-repeat.md @@ -0,0 +1,5 @@ +--- +'@vue-macros/volar': patch +--- + +allow v-slot:default in template tag diff --git a/packages/volar/src/jsx-directive.ts b/packages/volar/src/jsx-directive.ts index 4f0677c5..a109caf1 100644 --- a/packages/volar/src/jsx-directive.ts +++ b/packages/volar/src/jsx-directive.ts @@ -228,9 +228,11 @@ function transformVSlot({ for (const attr of child.openingElement.attributes.properties) { if (!ts.isJsxAttribute(attr)) continue if (isTemplateTag) { - name = ts.isJsxNamespacedName(attr.name) - ? attr.name.name - : undefined + name = + ts.isJsxNamespacedName(attr.name) && + attr.name.name.escapedText !== 'default' + ? attr.name.name + : undefined } if ( diff --git a/playground/vue3/src/examples/jsx-directive/v-slot/index.vue b/playground/vue3/src/examples/jsx-directive/v-slot/index.vue index bb979a93..944e172a 100644 --- a/playground/vue3/src/examples/jsx-directive/v-slot/index.vue +++ b/playground/vue3/src/examples/jsx-directive/v-slot/index.vue @@ -16,7 +16,9 @@ defineRender(() => (