Pisandelli
Best way to run code once on nuxt ready
I need to calculate a slope for a clamp(). But I don't want to use 16 as the root font size. I need this info coming from browser. Most people use 16px as root font size, but some people use different values. To calculate the clamp accordingly I need the number... 16 or 22 or x... I can't use 1rem because is a relative unit.
Anyway, the point is not the calc I need to do, but how to run a script only once, on the client side as soon as the app is ready, better before any css or html rendering.
😂
3 replies
how do you use defineNuxtComponent asyncData()
Take a look if it helps: https://nuxt.com/docs/api/utils/define-nuxt-component#asyncdata
30 replies