useRequestURL
useRequestURL
is a helper function that returns an URL object working on both server-side and client-side.
pages/about.vue
<script setup>
const url = useRequestURL()
</script>
<template>
<p>URL is: {{ url }}</p>
<p>Path is: {{ url.pathname }}</p>
</template>
You can find the list of the URL instance properties on the MDN documentation.