head
head copied to clipboard
`vueuse/head` doesn't support events when creating an element
Hi everybody.
I recently worked on new features that bring script loading strategy to the Nuxt. The problem is when I add some events to the script
component (provided by nuxt as sugar syntax of useMeta), it turned into attributes and prints the event function string on the element.
<script src="./mock.js?t=49" strategy="immediate" onload="function() { console.log('loaded')"></script>
hmm I think that should be implemented as a standalone <Script />
component outside vueuse/head.
Nuxt already did this. But the point is there is a problem when using events. As Vue 3 described, events attached to the component and not present in emits list, must be attached to the root element of the component. I think the script element created via vueuse/head
should support events.
I got your point 👌
This is available with the useHeadRaw
function.
Let me know if you have any questions