## ナビゲーションがしたいとき ```ts const router = useRouter() router.push({ path: '/hoge' }) ``` ## pathやqueryなどパラメータを取得したいとき ```ts const route = useRoute() // Path parametersの場合 const id = route.params.id // Query parametersの場合 const id = route.query.id ``` ## Vue2.7やNuxt2.16のとき `useRoute`や`useRouter`がない場合は[[vue2-helpers]]を使う。 ### メモ `getCurrentInstance`で以前自作していたが、これだとreactiveが上手く処理できなかった...。 ```ts <script setup lang="ts"> import { getCurrentInstance } from "vue"; const router = getCurrentInstance()?.proxy.$router!; </script> ```