Skip to content

Commit

Permalink
fix: missing edit links under non-contentLoading situations
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Nov 6, 2018
1 parent f39f79b commit 47e9654
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
9 changes: 3 additions & 6 deletions packages/@vuepress/core/lib/app/components/Content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default {
},
computed: {
$key () {
$pageKey () {
return this.pageKey || this.$page.key
},
disableTransition () {
Expand All @@ -44,14 +44,11 @@ export default {
},
created () {
this.loadContent(this.$key)
this.$vuepress.$on('AsyncMarkdownContentMounted', (slotKey) => {
this.$vuepress.$set('contentMounted', true)
})
this.loadContent(this.$pageKey)
},
watch: {
$key (key) {
$pageKey (key) {
this.$vuepress.$set('contentMounted', false)
this.reloadContent(key)
}
Expand Down
6 changes: 3 additions & 3 deletions packages/@vuepress/core/lib/app/plugins/VuePress.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class VuePress extends Store {

export default {
install (Vue) {
const store = new VuePress()
Vue.$vuepress = store
Vue.prototype.$vuepress = store
const ins = new VuePress()
Vue.$vuepress = ins
Vue.prototype.$vuepress = ins
}
}
13 changes: 13 additions & 0 deletions packages/@vuepress/core/lib/app/root-mixins/updateLoadingState.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default {
created () {
this.$vuepress.$on('AsyncMarkdownContentMounted', () => {
this.$vuepress.$set('contentMounted', true)
})
},

watch: {
$page () {
this.$vuepress.$set('contentMounted', false)
}
}
}
3 changes: 2 additions & 1 deletion packages/@vuepress/core/lib/internal-plugins/rootMixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ module.exports = (options, context, api) => ({
// @internal/root-mixins
async clientDynamicModules () {
const builtInRootMixins = [
path.resolve(__dirname, '../app/root-mixins/updateMeta.js')
path.resolve(__dirname, '../app/root-mixins/updateMeta.js'),
path.resolve(__dirname, '../app/root-mixins/updateLoadingState.js')
]

const rootMixins = [
Expand Down
1 change: 0 additions & 1 deletion packages/@vuepress/plugin-active-header-links/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ function getAnchors () {
export default {
mounted () {
this.$vuepress.$on('AsyncMarkdownContentMounted', (slotKey) => {
console.warn('AsyncMarkdownContentMounted')
if (slotKey === 'default') {
window.addEventListener('scroll', this.onScroll)
}
Expand Down

0 comments on commit 47e9654

Please sign in to comment.