Vue3 How to get the DOM element in Suspense

196 Views Asked by At

I need to get the reference of DOM Element in Suspense #default when the resolve event of the Suspense has emitted.

<script setup>
  function test(e){
      console.log(e) // Expected to get <p> element ref
    }
</script>

<template>
  <Suspense @resolve="test">
    <template #default>
      <p class="text">Some async component</p>
    </template>
    <template #fallback>
      Loading...
    </template>
  </Suspense>
</template>
0

There are 0 best solutions below