如果是vue3+ts可以这样
<script setup lang="ts"> import {computed,onMounted,ref,getCurrentInstance, ComponentInternalInstance } from "vue"; router.push({path:'/home/index',query:{businessCode:item.businessCode}}).catch(err => { if (err.name !== '首页') {//如果页面没有成功跳转到首页就自动刷新 const { proxy } = getCurrentInstance() as ComponentInternalInstance; proxy!.$forceUpdate() } });
</script>