vue3 watch用法

1、监听路由变化

import { ref, watch } from "vue"
import { useRoute } from "vue-router"

2、watch在监听 ref 类型时

import { ref, watch } from "vue"
import { useRoute } from "vue-router"

3、watch在监听 reactive 类型时

import { ref,reactive, watch } from "vue"
import { useRoute } from "vue-router"

4、开启深度监听和 immediate监听立即执行

import { ref,reactive, watch } from "vue"
import { useRoute } from "vue-router"

你可能感兴趣的:(vue3,vue3,watch)