Skip to content

Commit

Permalink
Fixes vuejs#4699
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Aug 25, 2024
1 parent c734ee9 commit 5a89862
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/language-core/lib/codegen/template/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,13 @@ export function* generateElement(
else {
yield* generateElementChildren(options, ctx, node, currentComponent, componentCtxVar);
}

if (
node.props.some(prop => prop.type === CompilerDOM.NodeTypes.DIRECTIVE && prop.name === 'bind' && prop.exp?.loc.source === '$attrs')
|| node === ctx.singleRootNode
) {
ctx.inheritedAttrVars.add(`__VLS_intrinsicElements.${node.tag}`);
}
}

function* generateVScope(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<script setup lang="ts">
defineProps<{
msg?: string
}>()
</script>

<template>
<div class="greetings">
<h1 class="green">{{ msg }}</h1>
<h3>
You’ve successfully created a project with
<a href="https://vitejs.dev/" target="_blank" rel="noopener">Vite</a> +
<a href="https://vuejs.org/" target="_blank" rel="noopener">Vue 3</a>.
</h3>
</div>
</template>

<style scoped>
h1 {
font-weight: 500;
font-size: 2.6rem;
position: relative;
top: -10px;
}
h3 {
font-size: 1.2rem;
}
.greetings h1,
.greetings h3 {
text-align: center;
}
@media (min-width: 1024px) {
.greetings h1,
.greetings h3 {
text-align: left;
}
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script setup lang="ts">
import HelloWorld from './HelloWorld.vue'
</script>

<template>
<HelloWorld msg="You did it!" id="4" />
<HelloWorld msg="You did it!" title="my html title" />
<HelloWorld msg="You did it!" aria-label="label" />
</template>

0 comments on commit 5a89862

Please sign in to comment.