keepAliveFixed 调整

This commit is contained in:
Shikong 2023-07-15 23:51:34 +08:00
parent fe4becce91
commit 772a2abd16

View File

@ -1,9 +1,8 @@
import {ref, watch} from "vue"; import {ref, onActivated} from "vue";
import {useRoute} from "vue-router"; import {useRoute} from "vue-router";
export function keepAliveFixed(tableRef){ export function keepAliveFixed(tableRef){
const route = useRoute() onActivated(()=>{
watch(route,()=>{
// 虚拟表格 keepAlive 切换后渲染空白 需要手动重新滚回顶部 以正常显示 // 虚拟表格 keepAlive 切换后渲染空白 需要手动重新滚回顶部 以正常显示
tableRef.value?.scrollToTop(0) tableRef.value?.scrollToTop(0)
}) })