(1) 使用getCurrentInstance
const {ctx} =getCurrentInstace()
//获取路由信息
ctx.$root.$route
//进行路由跳转
ctx.$root.$router.push()
(2) 使用useRouter
import {useRouter} from 'vue-router'
const router=useRouter()
router.push()
(1) 使用getCurrentInstance
const {ctx} =getCurrentInstace()
//获取路由信息
ctx.$root.$route
//进行路由跳转
ctx.$root.$router.push()
(2) 使用useRouter
import {useRouter} from 'vue-router'
const router=useRouter()
router.push()