File tree 1 file changed +18
-11
lines changed
Filter options
.vitepress/theme/nativescript-theme 1 file changed +18
-11
lines changed
Original file line number Diff line number Diff line change
1
+ import {
2
+ useRoute ,
3
+ useSiteDataByRoute ,
4
+ useSiteData ,
5
+ useRouter ,
6
+ inBrowser ,
7
+ } from 'vitepress'
1
8
import {
2
9
defineComponent ,
10
+ inject ,
3
11
getCurrentInstance ,
4
12
watch ,
5
13
onMounted ,
@@ -20,21 +28,13 @@ import {
20
28
onUnmounted ,
21
29
computed ,
22
30
h as h$1 ,
23
- inject ,
24
31
pushScopeId ,
25
32
popScopeId ,
26
33
createTextVNode ,
27
34
withScopeId ,
28
35
nextTick ,
29
36
renderSlot ,
30
37
} from 'vue'
31
- import {
32
- useRoute ,
33
- useRouter ,
34
- useSiteDataByRoute ,
35
- useSiteData ,
36
- inBrowser ,
37
- } from 'vitepress'
38
38
39
39
/*! @docsearch/js 1.0.0-alpha.28 (UNRELEASED 0a58769) | MIT License | © Algolia, Inc. and contributors | https://github.com/francoischalifour/autocomplete.js */
40
40
function e ( e , t , n ) {
@@ -6231,10 +6231,14 @@ var script$c = defineComponent({
6231
6231
} ,
6232
6232
} ,
6233
6233
setup : function setup ( __props ) {
6234
- var props = __props
6234
+ var props = __props // Important: we use injection because this component is used in both Vitepress & non-Vitepress contexts
6235
+ // these contexts must provide the useRouter/useRoute functions that we inject here.
6236
+
6237
+ var useRouter = inject ( 'useRouter' )
6238
+ var useRoute = inject ( 'useRoute' )
6235
6239
var vm = getCurrentInstance ( )
6236
- var route = useRoute ( )
6237
6240
var router = useRouter ( )
6241
+ var route = useRoute ( )
6238
6242
watch (
6239
6243
function ( ) {
6240
6244
return props . options
@@ -9084,7 +9088,10 @@ var theme = function theme(enhanceApp) {
9084
9088
9085
9089
app . component ( 'FlavorTabs' , script$1 )
9086
9090
app . component ( 'CodeTabs' , script )
9087
- app . component ( 'NotFound' , script$2 ) // provide globlal flavor value
9091
+ app . component ( 'NotFound' , script$2 ) // Important! Provide useRouter/useRouter injections
9092
+
9093
+ app . provide ( 'useRouter' , useRouter )
9094
+ app . provide ( 'useRoute' , useRoute ) // provide globlal flavor value
9088
9095
9089
9096
app . provide ( CurrentFlavorSymbol , createCurrentFlavor ( ) )
9090
9097
You can’t perform that action at this time.
0 commit comments