Nuxt 공식문서 번역/Composables
useRequestURL
Tech정개블
2023. 12. 14. 10:52
useRequestURL 는 서버 측과 클라이언트 측 모두에서 작동하는 URL 객체를 반환하는 헬퍼 함수다.
<!--
pages/about.vue
-->
<script setup lang="ts">
const url = useRequestURL()
</script>
<template>
<p>URL is: {{ url }}</p>
<p>Path is: {{ url.pathname }}</p>
</template>
output
<p>URL is: http://localhost:3000/about</p>
<p>Path is: /about</p>