-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
<script setup vapor>: component template ref is always undefined #14242
Copy link
Copy link
Closed
Labels
🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.interopvdom / vapor interopvdom / vapor interopscope: vaporrelated to vapor moderelated to vapor mode
Description
Vue version
3.6.0-beta.1
Link to minimal reproduction
Steps to reproduce
App.vue
<template>
<div>
<Comp ref="comp" />
<button @click="addB">+b</button>
</div>
</template>
<script setup lang="ts" vapor>
import { ref } from 'vue'
import Comp from './Comp.vue'
const comp = ref<InstanceType<typeof Comp>>()
const addB = () => {
console.log(comp.value) // is undefined in vapor mode
comp.value?.add()
}
</script>What is expected?
In vapor mode:
comp.value should reference the child component instance after mount
Exposed methods (defineExpose) should be callable
Behavior should be consistent with non-vapor mode, or clearly documented if unsupported
What is actually happening?
In vapor mode:
comp.value === undefined
Component instance and exposed methods are not accessible
In non-vapor mode:
Works as expected
System Info
Any additional comments?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.interopvdom / vapor interopvdom / vapor interopscope: vaporrelated to vapor moderelated to vapor mode