Skip to content

Commit feccffb

Browse files
committed
refactor: better content transition strategy
1 parent d9a8ced commit feccffb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: packages/@vuepress/core/lib/app/components/Content.vue

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<transition :name="layout === 'ContentLoading' || !layout ? null : 'fade'">
2+
<transition :name="disableTransition ? null : 'fade'">
33
<component
44
v-if="layout"
55
:is="layout"
@@ -24,13 +24,17 @@ export default {
2424
2525
data () {
2626
return {
27-
layout: 'ContentLoading'
27+
layout: 'ContentLoading',
28+
noTransition: true
2829
}
2930
},
3031
3132
computed: {
3233
$key () {
3334
return this.pageKey || this.$page.key
35+
},
36+
disableTransition () {
37+
return !this.layout || this.layout === 'ContentLoading' || this.noTransition
3438
}
3539
},
3640
@@ -62,10 +66,12 @@ export default {
6266
reloadContent (pageKey) {
6367
if (Vue.component(pageKey)) {
6468
this.layout = pageKey
69+
this.noTransition = true
6570
return
6671
}
6772
this.layout = 'ContentLoading'
6873
if (components[pageKey]) {
74+
this.noTransition = false
6975
if (!this.$ssrContext) {
7076
Promise.all([
7177
components[pageKey](),

0 commit comments

Comments
 (0)