Skip to content

Commit a9b2015

Browse files
committed
feat: implement components prop
1 parent 09ed428 commit a9b2015

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/Preview.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ export default {
2323
scoped: {
2424
type: Boolean,
2525
default: true
26+
},
27+
components: {
28+
type: Object,
29+
default: () => {}
2630
}
2731
},
2832
data() {
@@ -84,6 +88,8 @@ export default {
8488
this.handleError(e);
8589
}
8690
91+
data.components = this.components;
92+
8793
// eslint-disable-next-line no-new
8894
const vueInstance = new Vue({
8995
el: `#${this.scope}`,

src/VueLive.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
<PrismEditor v-model="model" :language="prismLang"/>
55
</template>
66
<template v-slot:preview>
7-
<Preview :key="codeKey" :code="model" @detect-language="switchLanguage"/>
7+
<Preview
8+
:key="codeKey"
9+
:code="model"
10+
@detect-language="switchLanguage"
11+
:components="components"
12+
/>
813
</template>
914
</VueLiveLayout>
1015
</template>
@@ -34,7 +39,12 @@ export default {
3439
required: true
3540
},
3641
layout: {
37-
type: Object
42+
type: Object,
43+
default: undefined
44+
},
45+
components: {
46+
type: Object,
47+
default: () => {}
3848
}
3949
},
4050
data() {

0 commit comments

Comments
 (0)