2222 />
2323 </div >
2424
25- <p >Here are a few examples of use</p >
26-
27- <h2 >Display Single File Components</h2 >
28- <VueLive :code =" codeSfc" :layout =" CustomLayout" />
29- <h2 >Pure JavaScript code</h2 >
30- <VueLive :code =" codeJs" :layout =" CustomLayout" />
31- <h2 >
32- Use the requires prop to make libraries and packages available in the
33- browser
34- </h2 >
35- <VueLive
36- :code =" codeChicago"
37- :layout =" CustomLayout"
38- :requires =" chicagoRequires"
39- />
40- <h2 >With a custom update delay of 2 seconds</h2 >
41- <VueLive
42- :code =" `<input type='button' value='update me' />`"
43- :layout =" CustomLayout"
44- :delay =" 2000"
45- />
46- <h2 >Default Layout</h2 >
47- <div style =" width : 950px ; max-width : 95vw ; margin : 20px auto ;" >
48- <VueLive :code =" `<input type='button' value='I am Groot' />`" />
49- </div >
50- <h2 >Custom Layout</h2 >
51- <div >
52- <p >Attributes available for custom layout:</p >
25+ <span v-if =" !openExamples" >+</span ><span v-else >-</span >  ;
26+ <a href =" #" @click =" openExamples = !openExamples" >More examples</a >
27+ <div v-if =" openExamples" >
28+ <h2 >Vue SFC</h2 >
29+ <p >
30+ If this format is not fitting for you, vue-live renders VueJs single
31+ file components as well
32+ </p >
33+ <VueLive :code =" codeSfc" :layout =" CustomLayout" />
34+ <h2 >Pure JavaScript code</h2 >
35+ <p >Or if you prefer to, use the <b >new Vue()</b > format</p >
36+ <VueLive :code =" codeJs" :layout =" CustomLayout" />
37+ <h2 >
38+ Extra dependencies
39+ </h2 >
5340 <p >
54- <code >code: String</code >, <code >language: String</code >,
55- <code >components: Object</code >, <code >requires: Object</code >, ... all
56- props passed in the
57- <code >layoutProps</code >
41+ Use the <b >requires</b > prop to make libraries and packages available in
42+ the browser
5843 </p >
5944 <VueLive
60- :code =" `<input type='button' value='I am Groot' />` "
45+ :code =" codeChicago "
6146 :layout =" CustomLayout"
47+ :requires =" chicagoRequires"
6248 />
63- </div >
64- <h2 >It even supports jsx</h2 >
65- <VueLive :code =" realjsx" :layout =" CustomLayout" :jsx =" true" />
66- <link
67- href =" https://fonts.googleapis.com/css?family=Roboto+Mono"
68- rel =" stylesheet"
69- />
70- <h2 >Separate use Editor and Preview with change event</h2 >
71- <div class =" separate" >
72- <div class =" preview-separate" >
73- <VueLivePreview :code =" separateCode" />
49+ <h2 >Custom delay</h2 >
50+ <p >
51+ when updates should not hapen too often, for instance when a component
52+ need a lot of computing power to render, One can change the standard
53+ throttle timing.
54+ </p >
55+ <VueLive
56+ :code =" `<input type='button' value='update me' />`"
57+ :layout =" CustomLayout"
58+ :delay =" 2000"
59+ />
60+
61+ <h2 >Default Layout</h2 >
62+ <div style =" width : 950px ; max-width : 95vw ; margin : 20px auto ;" >
63+ <VueLive :code =" `<input type='button' value='I am Groot' />`" />
64+ </div >
65+ <h2 >Custom Layout</h2 >
66+ <div >
67+ <p >Attributes available for custom layout:</p >
68+ <p >
69+ <code >code: String</code >, <code >language: String</code >,
70+ <code >components: Object</code >, <code >requires: Object</code >, ...
71+ all props passed in the
72+ <code >layoutProps</code >
73+ </p >
74+ <VueLive
75+ :code =" `<input type='button' value='I am Groot' />`"
76+ :layout =" CustomLayout"
77+ />
78+ </div >
79+
80+ <h2 >JSX</h2 >
81+ <VueLive :code =" realjsx" :layout =" CustomLayout" :jsx =" true" />
82+
83+ <h2 >Separate components for Editor and Preview</h2 >
84+ <div class =" separate" >
85+ <div class =" preview-separate" >
86+ <VueLivePreview :code =" separateCode" />
87+ </div >
88+ <hr style =" width : 950px ;" />
89+ <p >Edit the code here</p >
90+ <VueLiveEditor :code =" separateCode" @change =" updateCode" />
91+ <div class =" button-bar" ><button >Save</button ></div >
7492 </div >
75- <hr style =" width : 950px ;" />
76- <p >Edit the code here</p >
77- <VueLiveEditor :code =" separateCode" @change =" updateCode" />
78- <div class =" button-bar" ><button >Save</button ></div >
7993 </div >
8094
8195 <github-corners
@@ -114,6 +128,7 @@ export default {
114128 chicagoRequires: { " ./chicagoNeighbourhoods" : all },
115129 realjsx,
116130 separateCode: codeSfc,
131+ openExamples: false ,
117132 };
118133 },
119134 methods: {
@@ -126,6 +141,7 @@ export default {
126141
127142<style >
128143@import url (" https://fonts.googleapis.com/css2?family=Nanum+Pen+Script&display=swap" );
144+ @import url (" https://fonts.googleapis.com/css2?family=Roboto+Mono&display=swap" );
129145
130146body {
131147 font-family : " Roboto Mono" , monospace ;
0 commit comments