Skip to content

Commit 56ba317

Browse files
committed
chore: update theme
1 parent 909b75e commit 56ba317

File tree

1 file changed

+18
-11
lines changed
  • .vitepress/theme/nativescript-theme

1 file changed

+18
-11
lines changed

.vitepress/theme/nativescript-theme/index.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1+
import {
2+
useRoute,
3+
useSiteDataByRoute,
4+
useSiteData,
5+
useRouter,
6+
inBrowser,
7+
} from 'vitepress'
18
import {
29
defineComponent,
10+
inject,
311
getCurrentInstance,
412
watch,
513
onMounted,
@@ -20,21 +28,13 @@ import {
2028
onUnmounted,
2129
computed,
2230
h as h$1,
23-
inject,
2431
pushScopeId,
2532
popScopeId,
2633
createTextVNode,
2734
withScopeId,
2835
nextTick,
2936
renderSlot,
3037
} from 'vue'
31-
import {
32-
useRoute,
33-
useRouter,
34-
useSiteDataByRoute,
35-
useSiteData,
36-
inBrowser,
37-
} from 'vitepress'
3838

3939
/*! @docsearch/js 1.0.0-alpha.28 (UNRELEASED 0a58769) | MIT License | © Algolia, Inc. and contributors | https://github.com/francoischalifour/autocomplete.js */
4040
function e(e, t, n) {
@@ -6231,10 +6231,14 @@ var script$c = defineComponent({
62316231
},
62326232
},
62336233
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')
62356239
var vm = getCurrentInstance()
6236-
var route = useRoute()
62376240
var router = useRouter()
6241+
var route = useRoute()
62386242
watch(
62396243
function () {
62406244
return props.options
@@ -9084,7 +9088,10 @@ var theme = function theme(enhanceApp) {
90849088

90859089
app.component('FlavorTabs', script$1)
90869090
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
90889095

90899096
app.provide(CurrentFlavorSymbol, createCurrentFlavor())
90909097

0 commit comments

Comments
 (0)