nuxt3 如何监听路由变化?

nuxt3 如何监听路由变化?

<script lang="ts">
import { defineComponent, vue, watch } from "vue"
import { useRoute } from "vue-router"

export default defineComponent({
  setup() {
    const route = useRoute()
    watch(route, (to) => {
  		console.log('路由',to)
    }, {flush: 'pre', immediate: true, deep: true})
  },
})
</script>

你可能感兴趣的:(javascript,前端,vue.js,nuxt)