使用 useRequestEvent 组合式函数访问传入的请求事件。
在 Nuxt 上下文 中,你可以使用 useRequestEvent 来访问传入的请求。
useRequestEvent
// 获取底层请求事件 const event = useRequestEvent() // 获取 URL const url = event?.path
在浏览器中,useRequestEvent 会返回 undefined。 :
undefined