mirror of https://github.com/vuejs/vitepress
parent
9bd79e8de1
commit
8809d2dbfc
@ -0,0 +1,11 @@
|
|||||||
|
import { ref, onMounted, defineComponent } from 'vue'
|
||||||
|
|
||||||
|
export const ClientOnly = defineComponent({
|
||||||
|
setup(_, { slots }) {
|
||||||
|
const show = ref(false)
|
||||||
|
onMounted(() => {
|
||||||
|
show.value = true
|
||||||
|
})
|
||||||
|
return () => (show.value && slots.default ? slots.default() : null)
|
||||||
|
}
|
||||||
|
})
|
@ -1,10 +1,10 @@
|
|||||||
import { h } from 'vue'
|
import { defineComponent, h } from 'vue'
|
||||||
import { useRoute } from '../router'
|
import { useRoute } from '../router'
|
||||||
|
|
||||||
export const Content = {
|
export const Content = defineComponent({
|
||||||
name: 'VitePressContent',
|
name: 'VitePressContent',
|
||||||
setup() {
|
setup() {
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
return () => (route.component ? h(route.component) : null)
|
return () => (route.component ? h(route.component) : null)
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
Loading…
Reference in new issue