Skip to content

Commit 47e9654

Browse files
committed
fix: missing edit links under non-contentLoading situations
1 parent f39f79b commit 47e9654

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

packages/@vuepress/core/lib/app/components/Content.vue

+3-6
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default {
3535
},
3636
3737
computed: {
38-
$key () {
38+
$pageKey () {
3939
return this.pageKey || this.$page.key
4040
},
4141
disableTransition () {
@@ -44,14 +44,11 @@ export default {
4444
},
4545
4646
created () {
47-
this.loadContent(this.$key)
48-
this.$vuepress.$on('AsyncMarkdownContentMounted', (slotKey) => {
49-
this.$vuepress.$set('contentMounted', true)
50-
})
47+
this.loadContent(this.$pageKey)
5148
},
5249
5350
watch: {
54-
$key (key) {
51+
$pageKey (key) {
5552
this.$vuepress.$set('contentMounted', false)
5653
this.reloadContent(key)
5754
}

packages/@vuepress/core/lib/app/plugins/VuePress.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class VuePress extends Store {
2929

3030
export default {
3131
install (Vue) {
32-
const store = new VuePress()
33-
Vue.$vuepress = store
34-
Vue.prototype.$vuepress = store
32+
const ins = new VuePress()
33+
Vue.$vuepress = ins
34+
Vue.prototype.$vuepress = ins
3535
}
3636
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export default {
2+
created () {
3+
this.$vuepress.$on('AsyncMarkdownContentMounted', () => {
4+
this.$vuepress.$set('contentMounted', true)
5+
})
6+
},
7+
8+
watch: {
9+
$page () {
10+
this.$vuepress.$set('contentMounted', false)
11+
}
12+
}
13+
}

packages/@vuepress/core/lib/internal-plugins/rootMixins.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ module.exports = (options, context, api) => ({
77
// @internal/root-mixins
88
async clientDynamicModules () {
99
const builtInRootMixins = [
10-
path.resolve(__dirname, '../app/root-mixins/updateMeta.js')
10+
path.resolve(__dirname, '../app/root-mixins/updateMeta.js'),
11+
path.resolve(__dirname, '../app/root-mixins/updateLoadingState.js')
1112
]
1213

1314
const rootMixins = [

packages/@vuepress/plugin-active-header-links/mixin.js

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ function getAnchors () {
4444
export default {
4545
mounted () {
4646
this.$vuepress.$on('AsyncMarkdownContentMounted', (slotKey) => {
47-
console.warn('AsyncMarkdownContentMounted')
4847
if (slotKey === 'default') {
4948
window.addEventListener('scroll', this.onScroll)
5049
}

0 commit comments

Comments
 (0)