在app.vue页面中
<script setup>
import { ref, reactive, provide, onBeforeMount, onMounted, watch, inject,getCurrentInstance } from 'vue'
import { useRoute, useRouter } from 'vue-router'
//路由跳转
const router = useRouter()
//获取数据
const route = useRoute()
const { proxy } = getCurrentInstance();
//监听当前路由
watch(() => router.currentRoute.value.path, (newValue, oldValue) => {
//获取所有路由
var allroute = proxy.$router.options.routes
console.log('oldValue:'+oldValue)
console.log('newValue:'+newValue)
console.log(allroute)
}, { immediate: true })
</script>