Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: 页面切换性能优化 #600

Merged
merged 2 commits into from
Jun 13, 2023
Merged

perf: 页面切换性能优化 #600

merged 2 commits into from
Jun 13, 2023

Conversation

xiaoxian521
Copy link
Member

No description provided.

@xiaoxian521 xiaoxian521 reopened this Jun 10, 2023
@xiaoxian521
Copy link
Member Author

xiaoxian521 commented Jun 11, 2023

Test Report

优化前

1. 每次切换菜单时 changLayoutRoute 都会执行四次,而且四次都是重复、浪费的

21821686396664_ pic_hd

2. 当通过 paramsquery 路由传参同时出现在标签页时 dynamicTagView 函数返回值异常

21831686396887_ pic_hd

3. 页面刷新时静态路由在 router.beforeEach 中也会执行两次,这是一种浪费,对于动态路由会执行两次,是因为第一次动态路由还未完全添加到路由列表中,第二次才真正添加进去,如果需要在 router.beforeEach 做一些判断可以在 to.name 存在的条件下去判断,这样就只会触发一次

21841686404787_ pic_hd

优化后

1. 每次切换菜单时 changLayoutRoute 只执行一次

image

2. 当通过 paramsquery 路由传参同时出现在标签页时 dynamicTagView 函数返回值正常

image

3. 页面刷新时静态路由在 router.beforeEach 中只执行一次,动态路由在 to.name 存在的条件也只会执行一次

image image

@xiaoxian521 xiaoxian521 added test:pass 测试通过 and removed test:waiting 等待测试 labels Jun 13, 2023
@xiaoxian521 xiaoxian521 merged commit 5d86b71 into main Jun 13, 2023
@xiaoxian521 xiaoxian521 deleted the perf/performance branch June 13, 2023 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test:add report 需要添加测试报告 test:pass 测试通过
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant