There is an event listener set up within the script setup
block:
<script setup>
import {ref} from 'vue'
const elementRef = ref(null)
window.addEventListener('click', (event) => {
if (!elementRef.value.contains(event.target)){
console.log('Click detected outside of element')
}
})
</script>
<template>
<div ref="elementRef">Your element</div>
</template>
Will this event listener automatically be removed upon component unmount, or must it be manually removed?