Skip to content

Commit b1d23e1

Browse files
authored
Merge pull request #19 from r4fx/master
feat: make code & language accessible for custom layout
2 parents 125611f + d50bb87 commit b1d23e1

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

demo/App.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@
1919
:delay="2000"
2020
/>
2121
<h2>Default Layout</h2>
22-
<div style="width:950px; width:950px; max-width:95vw; margin:20px auto;">
22+
<div style="width:950px; max-width:95vw; margin:20px auto;">
2323
<VueLive :code="`<input type='button' value='I am Groot' />`"/>
2424
</div>
25+
<h2>Custom Layout</h2>
26+
<div>
27+
<p>Attributes available for custom layout: <code>code: String</code>, <code>language: String</code></p>
28+
<VueLive :code="`<input type='button' value='I am Groot' />`" :layout="CustomLayout"/>
29+
</div>
2530
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
2631
</main>
2732
</template>

src/VueLive.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<component :is="layout ? layout : VueLiveDefaultLayout">
2+
<component :is="layout ? layout : VueLiveDefaultLayout" :code="stableCode" :language="prismLang">
33
<template v-slot:editor>
44
<PrismEditor v-model="stableCode" @change="updatePreview" :language="prismLang"/>
55
</template>

0 commit comments

Comments
 (0)