<router-view :key="key"></router-view>
<script>
export default {
computed: {
//router-view指定唯一key,路由切换时重新渲染触发钩子
key() {
return this.$route.name !== undefined ?
this.$route.name + +new Date(): this.$route + +new Date()
}
}
}
</script>
vue跳转当前组件时重新渲染
最新推荐文章于 2024-02-29 20:37:24 发布