File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ const store = new ReplStore({
11
11
const preferComposition = inject (' prefer-composition' ) as Ref <boolean >
12
12
const preferSFC = inject (' prefer-sfc' ) as Ref <boolean >
13
13
14
- window .addEventListener (' hashchange' , updateExample )
15
14
watchEffect (updateExample )
15
+ window .addEventListener (' hashchange' , updateExample )
16
16
17
17
/**
18
18
* We perform some runtime logic to transform source files into different
@@ -21,17 +21,17 @@ watchEffect(updateExample)
21
21
* - plain HTML vs. SFCs
22
22
*/
23
23
function updateExample() {
24
- const hash = ___location .hash .slice (1 )
25
- if (data .hasOwnProperty (hash )) {
26
- store .setFiles (
27
- preferSFC .value
28
- ? resolveSFCExample (data [hash ])
29
- : resolveNoBuildExample (data [hash ]),
30
- preferSFC .value ? ' App.vue' : ' index.html'
31
- )
32
- } else if (! hash ) {
33
- ___location .hash = ' #markdown'
24
+ let hash = ___location .hash .slice (1 )
25
+ if (! data .hasOwnProperty (hash )) {
26
+ hash = ' markdown'
27
+ ___location .hash = ` #${hash } `
34
28
}
29
+ store .setFiles (
30
+ preferSFC .value
31
+ ? resolveSFCExample (data [hash ])
32
+ : resolveNoBuildExample (data [hash ]),
33
+ preferSFC .value ? ' App.vue' : ' index.html'
34
+ )
35
35
}
36
36
37
37
type ExampleData = {
You can’t perform that action at this time.
0 commit comments