Skip to content

Commit

Permalink
fix: access to slots directly (#3671)
Browse files Browse the repository at this point in the history
Co-authored-by: Johnson Chu <johnsoncodehk@gmail.com>
  • Loading branch information
so1ve and johnsoncodehk committed Oct 22, 2023
1 parent 2a44b10 commit 8476cd8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/vue-language-core/src/generators/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ export function generate(
let expectedErrorStart: undefined | number;
let expectedErrorNode: CompilerDOM.CommentNode | undefined;

if (slotsAssignName) {
localVars.set(slotsAssignName, 1);
}

if (propsAssignName) {
localVars.set(propsAssignName, 1);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template>
{{ slots.footer }}
</template>

<script lang="ts" setup generic="T extends string">
const slots = defineSlots<Record<T, () => any> & { footer(props: { id: number }): any}>();
</script>

0 comments on commit 8476cd8

Please sign in to comment.