when dispatch CustomEvent will be Maximum call stack size exceeded
Vue version
3.2.39
Link to minimal reproduction
Steps to reproduce
1.click div 2.console error
What is expected?
no error
What is actually happening?
Uncaught RangeError: Maximum call stack size exceeded
System Info
No response
Any additional comments?
No response
Here is the correct usage:
// App.vue
<script setup>
import { ref } from 'vue'
import Comp from "./Comp.vue"
const msg = ref('Hello World!')
const onRenderClick = e=>{
console.log(1)
}
</script>
<template>
<div>
<Comp @renderClick="onRenderClick"/>
</div>
</template>
// Comp.vue
<script setup>
import { ref } from 'vue'
const click = e=>{
e.target.dispatchEvent(new CustomEvent('render-click', {
bubbles: true,
detail: {
demo:'click'
}
}))
}
</script>
<template>
<div style="background:red;color:#ffffff" @click="click">
click me
</div>
</template>