useRequestEvent

使用 useRequestEvent 可组合项访问传入的请求事件。

Nuxt 上下文 中,你可以使用 useRequestEvent 访问传入的请求。

¥Within the Nuxt context you can use useRequestEvent to access the incoming request.

// Get underlying request event
const event = useRequestEvent()

// Get the URL
const url = event?.path
在浏览器中,useRequestEvent 将返回 undefined