Skip to content

Commit 34f614d

Browse files
author
Franck Freiburger
committed
wip(docs): fixing examples
1 parent 1901e67 commit 34f614d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

docs/examples.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ In the following examples, for convenience, we just returns static content as fi
6767
<html>
6868
<body>
6969
<div id="app"></div>
70-
<script src="https://unpkg.com/vue"></script>
70+
<script src="https://unpkg.com/vue@2/dist/vue.runtime.min.js"></script>
7171
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue2-sfc-loader.js"></script>
7272
<script>
7373
@@ -145,7 +145,8 @@ In the following examples, for convenience, we just returns static content as fi
145145
<html>
146146
<body>
147147
<div id="app"></div>
148-
<script src="https://unpkg.com/vue@3/dist/vue.runtime.global.prod.js"></script>
148+
<!-- here we need to load Vue3 full version because we use template:'...' -->
149+
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
149150
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue3-sfc-loader.js"></script>
150151
<script>
151152
@@ -531,6 +532,7 @@ _see at [vuejs/rfcs](https://github.com/vuejs/rfcs/pull/231)_
531532
```
532533
<!--example:target:import_style-->
533534
[open in JSBin ▶](http://jsbin.com/?html,output&html=%3C!DOCTYPE+html%3E%0A%3Chtml%3E%0A%3Cbody%3E%0A++%3Cscript+src%3D%22https%3A%2F%2Funpkg.com%2Fvue%403%2Fdist%2Fvue.runtime.global.prod.js%22%3E%3C%2Fscript%3E%0A++%3Cscript+src%3D%22https%3A%2F%2Fcdn.jsdelivr.net%2Fnpm%2Fvue3-sfc-loader%400.8.4%2Fdist%2Fvue3-sfc-loader.js%22%3E%3C%2Fscript%3E%0A++%3Cscript%3E%0A%0A++++%2F*+%3C!--+*%2F%0A++++const+config+%3D+%7B%0A++++++%0A++++++%2F%2F+note%3A+Here%2C+for+convenience%2C+we+simply+retrieve+content+from+a+string.%0A++++++%0A++++++files%3A+%7B%0A%0A++++++++'%2Fstyle.css'%3A+%60%0A++++++++++.styled+%7B+color%3A+red+%7D%0A++++++++%60%2C%0A%0A++++++++'%2Fmain.vue'%3A+%60%0A++++++++++%3Ctemplate%3E%0A++++++++++++%3Cspan+class%3D%22styled%22%3Ehello%3C%2Fspan%3E+world%0A++++++++++%3C%2Ftemplate%3E%0A++++++++++%3Cscript%3E%0A++++++++++++import+'.%2Fstyle.css'%0A++++++++++++export+default+%7B%0A++++++++++++%7D%0A++++++++++%3C%2Fscript%3E%0A++++++++%60%2C%0A++++++%7D%0A++++%7D%3B%0A++++%2F*+--%3E+*%2F%0A%0A++++const+options+%3D+%7B%0A++++++moduleCache%3A+%7B+vue%3A+Vue+%7D%2C%0A++++++getFile%3A+url+%3D%3E+config.files%5Burl%5D%2C%0A++++++addStyle(textContent)+%7B%0A%0A++++++++const+style+%3D+Object.assign(document.createElement('style')%2C+%7B+textContent+%7D)%3B%0A++++++++const+ref+%3D+document.head.getElementsByTagName('style')%5B0%5D+%7C%7C+null%3B%0A++++++++document.head.insertBefore(style%2C+ref)%3B%0A++++++%7D%2C%0A++++++handleModule%3A+async+function+(type%2C+getContentData%2C+path%2C+options)+%7B+%0A++++++++switch+(type)+%7B+%0A++++++++++case+'.css'%3A%0A++++++++++++options.addStyle(await+getContentData(false))%3B%0A++++++++++++return+null%3B%0A++++++++%7D+%0A++++++%7D%2C%0A++++%7D%0A%0A++++Vue.createApp(Vue.defineAsyncComponent(()+%3D%3E+window%5B'vue3-sfc-loader'%5D.loadModule('%2Fmain.vue'%2C+options))).mount(document.body)%3B%0A%0A++%3C%2Fscript%3E%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E%0A)<!--/example:target:import_style-->
535+
534536
[:top:](#readme)
535537

536538

@@ -621,7 +623,8 @@ In the following example we use a trick to preserve reactivity through the `Vue.
621623
<html>
622624
<body>
623625
<div id="app"></div>
624-
<script src="https://unpkg.com/vue@3/dist/vue.runtime.global.prod.js"></script>
626+
<!-- here we need to load Vue3 full version because we use template:'...' -->
627+
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
625628
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue3-sfc-loader.js"></script>
626629
<script>
627630

0 commit comments

Comments
 (0)