File tree 4 files changed +26
-2
lines changed
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'
11
11
12
12
// built-in components
13
13
import Content from './components/Content'
14
+ import ContentSlotsDistributor from './components/ContentSlotsDistributor'
14
15
import OutboundLink from './components/OutboundLink.vue'
15
16
import ClientOnly from './components/ClientOnly'
16
17
@@ -36,6 +37,7 @@ Vue.use(Router)
36
37
Vue . mixin ( dataMixin ( ClientComputedMixin , siteData ) )
37
38
// component for rendering markdown content and setting title etc.
38
39
Vue . component ( 'Content' , Content )
40
+ Vue . component ( 'ContentSlotsDistributor' , ContentSlotsDistributor )
39
41
Vue . component ( 'OutboundLink' , OutboundLink )
40
42
// component for client-only content
41
43
Vue . component ( 'ClientOnly' , ClientOnly )
Original file line number Diff line number Diff line change @@ -22,7 +22,9 @@ export default {
22
22
return h ( pageKey , {
23
23
class : [ data . class , data . staticClass ] ,
24
24
style : data . style ,
25
- slot : props . slot || 'default'
25
+ props : {
26
+ slotKey : props . slot || 'default'
27
+ }
26
28
} )
27
29
}
28
30
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) {
100
100
101
101
const res = (
102
102
`<template>\n` +
103
- `<div class="content ">${ html } </div >\n` +
103
+ `<ContentSlotsDistributor :slot-key="slotKey ">${ html } </ContentSlotsDistributor >\n` +
104
104
`</template>\n` +
105
+ `<script>export default { props: ['slot-key'] }</script>` +
105
106
( hoistedTags || [ ] ) . join ( '\n' ) +
106
107
`\n${ dataBlockString } \n`
107
108
)
You can’t perform that action at this time.
0 commit comments