Skip to content

Commit 1fe1694

Browse files
committed
feat: add layoutProps to pass props to layout
1 parent 3eb8898 commit 1fe1694

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

demo/App.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@
2424
</div>
2525
<h2>Custom Layout</h2>
2626
<div>
27-
<p>Attributes available for custom layout: </p>
27+
<p>Attributes available for custom layout:</p>
2828
<p>
29-
<code>code: String</code>, <code>language: String</code>,
30-
<code>components: Object</code>, <code>requires: Object</code>
29+
<code>code: String</code>,
30+
<code>language: String</code>,
31+
<code>components: Object</code>,
32+
<code>requires: Object</code>,
33+
... all props passed in the
34+
<code>layoutProps</code>
3135
</p>
32-
<VueLive :code="`<input type='button' value='I am Groot' />`" :layout="CustomLayout"/>
36+
<VueLive :code="`<input type='button' value='I am Groot' />`" :layout="CustomLayout" />
3337
</div>
3438
<h2>It even supports jsx</h2>
3539
<VueLive :code="realjsx" :layout="CustomLayout" :jsx="true" />

src/VueLive.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22
<component
33
:is="layout ? layout : VueLiveDefaultLayout"
4+
...layoutProps
45
:code="stableCode"
56
:language="lang"
67
:prismLang="prismLang"
@@ -91,6 +92,14 @@ export default {
9192
jsx: {
9293
type: Boolean,
9394
default: false
95+
},
96+
/**
97+
* These props will be passed as a spreat to your layout
98+
* They can be used to change the style
99+
*/
100+
layoutProps: {
101+
type: Object,
102+
default: undefined
94103
}
95104
},
96105
data() {

0 commit comments

Comments
 (0)