<script setup lang="ts"> import { getCurrentInstance } from 'vue' let { proxy } = getCurrentInstance() as any watch(() => proxy.$route, (newRoute, oldRoute) => { console.log(newRoute, oldRoute) }, { immediate: true }) </script>