Skip to content

Commit

Permalink
refactor: simplify the implementation of makrdown slots
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Sep 8, 2018
1 parent 1cba9bc commit 20d612c
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 15 deletions.
2 changes: 0 additions & 2 deletions packages/@vuepress/core/lib/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import('@temp/style.styl')

// built-in components
import Content from './components/Content'
import ContentSlotsDistributor from './components/ContentSlotsDistributor'
import OutboundLink from './components/OutboundLink.vue'
import ClientOnly from './components/ClientOnly'

Expand All @@ -36,7 +35,6 @@ Vue.use(Router)
Vue.mixin(dataMixin(I18n, siteData))
// component for rendering markdown content and setting title etc.
Vue.component('Content', Content)
Vue.component('ContentSlotsDistributor', ContentSlotsDistributor)
Vue.component('OutboundLink', OutboundLink)
// component for client-only content
Vue.component('ClientOnly', ClientOnly)
Expand Down
5 changes: 2 additions & 3 deletions packages/@vuepress/core/lib/app/components/Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ export default {
render (h, { parent, props, data }) {
const pageKey = props.pageKey || parent.$page.key
Vue.component(pageKey, components[pageKey])

return h(pageKey, {
class: [props.custom ? 'custom' : '', data.class, data.staticClass],
style: data.style,
props: {
target: props.slot || 'default'
}
slot: props.slot || 'default'
})
}
}

This file was deleted.

2 changes: 1 addition & 1 deletion packages/@vuepress/core/lib/webpack/markdownLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ module.exports = function (src) {

const res = (
`<template>\n` +
`<ContentSlotsDistributor :target="target">${html}</ContentSlotsDistributor>\n` +
`<div class="content">${html}</div>\n` +
`</template>\n` +
`<script>export default { props: ['target'] }</script>` +
(hoistedTags || []).join('\n')
Expand Down

0 comments on commit 20d612c

Please sign in to comment.