useRequestEvent

原始檔
使用 useRequestEvent 可組合函式訪問傳入的請求事件。

Nuxt 上下文中,您可以使用 useRequestEvent 來訪問傳入請求。

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

// Get the URL
const url = event?.path
在瀏覽器中,useRequestEvent 將返回 undefined