File tree Expand file tree Collapse file tree 4 files changed +26
-2
lines changed
Expand file tree Collapse file tree 4 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import Store from './Store'
1111
1212// built-in components
1313import Content from './components/Content'
14+ import ContentSlotsDistributor from './components/ContentSlotsDistributor'
1415import OutboundLink from './components/OutboundLink.vue'
1516import ClientOnly from './components/ClientOnly'
1617
@@ -36,6 +37,7 @@ Vue.use(Router)
3637Vue . mixin ( dataMixin ( ClientComputedMixin , siteData ) )
3738// component for rendering markdown content and setting title etc.
3839Vue . component ( 'Content' , Content )
40+ Vue . component ( 'ContentSlotsDistributor' , ContentSlotsDistributor )
3941Vue . component ( 'OutboundLink' , OutboundLink )
4042// component for client-only content
4143Vue . component ( 'ClientOnly' , ClientOnly )
Original file line number Diff line number Diff line change @@ -22,7 +22,9 @@ export default {
2222 return h ( pageKey , {
2323 class : [ data . class , data . staticClass ] ,
2424 style : data . style ,
25- slot : props . slot || 'default'
25+ props : {
26+ slotKey : props . slot || 'default'
27+ }
2628 } )
2729 }
2830 return h ( '' )
Original file line number Diff line number Diff line change 1+ export default {
2+ functional : true ,
3+ props : {
4+ slotKey : String ,
5+ required : true
6+ } ,
7+ render ( h , { props, slots } ) {
8+ console . log ( props . slotKey )
9+ return h ( 'div' ,
10+ {
11+ class : [
12+ 'content' ,
13+ props . slotKey
14+ ]
15+ } ,
16+ slots ( ) [ props . slotKey ]
17+ )
18+ }
19+ }
Original file line number Diff line number Diff line change @@ -100,8 +100,9 @@ module.exports = function (src) {
100100
101101 const res = (
102102 `<template>\n` +
103- `<div class="content ">${ html } </div >\n` +
103+ `<ContentSlotsDistributor :slot-key="slotKey ">${ html } </ContentSlotsDistributor >\n` +
104104 `</template>\n` +
105+ `<script>export default { props: ['slot-key'] }</script>` +
105106 ( hoistedTags || [ ] ) . join ( '\n' ) +
106107 `\n${ dataBlockString } \n`
107108 )
You can’t perform that action at this time.
0 commit comments