fix(layout): 修复缓存路由切换时页面布局错位 - #322
Open
Silent-12 wants to merge 1 commit into
Open
Conversation
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


问题描述
页面内容布局中,缓存路由和非缓存路由分别使用了两个独立的
Transition。当缓存路由与非缓存路由之间切换时,两个
Transition会同时执行动画。由于mode="out-in"只能协调同一个Transition内部的组件,无法协调两个独立的Transition,导致旧页面离场和新页面入场期间同时处于正常文档流中。因此,新页面中的
ArtBasicBanner等内容可能暂时显示在旧页面内容底部,动画结束后才恢复到正确位置。复现步骤
/system/user。/dashboard/ecommerce。修复方案
将缓存路由和非缓存路由统一放入同一个
Transition中,并保持KeepAlive始终挂载。对于
keepAlive: false的当前路由,动态加入KeepAlive的exclude列表,从而保留原有的路由缓存策略。这样所有页面切换都由同一个
mode="out-in"统一协调,避免新旧页面同时参与文档流。验证结果