当vue 3 中A页面刷新本身, 使用间接跳转实现:
A -> B, 再由B->A
warn 代码:
<script>
import { h } from 'vue'
export default {
created() {
const { params, query } = this.$route
const { path } = params
this.$router.replace({ path: '/' + path, query })
},
render() {
return h() // avoid warning message
}
}
</script>
解决方案: 不用render方法, 直接用静态template:
<template>
<div></div>
</template>
<script>
export default {
created() {
const { params, query } = this.$route
const { path } = params
this.$router.replace({ path: '/' + path, query })
}
}
</script>
解决warn