Skip to content

Commit 4b6c63c

Browse files
wip(docs): update examples
1 parent 0deb95f commit 4b6c63c

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

docs/examples.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -745,26 +745,30 @@ In the following example we use a trick to preserve reactivity through the `Vue.
745745
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue3-sfc-loader.js"></script>
746746
<script>
747747
748-
/* <!-- */
749748
const config = {
750749
files: {
751-
'/main.vue': `
752-
<template>
753-
<pre><b>'url!./circle.svg' -> </b>{{ require('url!./circle.svg') }}</pre>
754-
<img width="50" height="50" src="~url!./circle.svg" />
755-
<pre><b>'file!./circle.svg' -> </b>{{ require('file!./circle.svg') }}</pre>
756-
<img width="50" height="50" src="~file!./circle.svg" />
757-
</template>
758-
`,
759-
'/circle.svg': `
760-
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
761-
<circle cx="50" cy="50" r="50" />
762-
</svg>
763-
`,
750+
'/main.vue': {
751+
content: /* <!-- */`
752+
<template>
753+
<pre><b>'url!./circle.svg' -> </b>{{ require('url!./circle.svg') }}</pre>
754+
<img width="50" height="50" src="~url!./circle.svg" />
755+
<pre><b>'file!./circle.svg' -> </b>{{ require('file!./circle.svg') }}</pre>
756+
<img width="50" height="50" src="~file!./circle.svg" />
757+
</template>
758+
`/* --> */,
759+
type: '.vue',
760+
},
761+
'/circle.svg': {
762+
content: /* <!-- */`
763+
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
764+
<circle cx="50" cy="50" r="50" />
765+
</svg>
766+
`/* --> */,
767+
type: '.svg',
768+
}
764769
}
765770
};
766-
/* --> */
767-
771+
768772
const options = {
769773
moduleCache: {
770774
'vue': Vue,
@@ -789,6 +793,8 @@ In the following example we use a trick to preserve reactivity through the `Vue.
789793
},
790794
getFile(url, options) {
791795
796+
797+
792798
return config.files[url] || (() => { throw new Error('404 ' + url) })();
793799
},
794800
getResource({ refPath, relPath }, options) {

0 commit comments

Comments
 (0)