File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
docs/.vitepress/theme/components Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 44
55<script setup lang="ts">
66import { useRoute , useData } from ' vitepress' ;
7- import { computed , watch } from ' vue'
7+ import { computed , onMounted , watch } from ' vue'
88const baseUrl = process .env .NODE_ENV === ' production' ? ` ${location .origin }/demo/?timestamp=${new Date ().getTime ()}#/ ` : ' http://localhost:5173/demo/#/'
99
1010const route = useRoute ()
@@ -22,11 +22,22 @@ const href = computed(() => {
2222
2323const vitepressData = useData ()
2424
25+ onMounted (() => {
26+ setTimeout (() => {
27+ ssendMessage ()
28+ }, 500 );
29+ })
30+
2531
2632watch (() => vitepressData .isDark .value , () => {
33+ ssendMessage ()
34+ })
35+
36+ function ssendMessage(){
2737 const iFrame: any = document .getElementById (' demo' )
2838 iFrame && iFrame .contentWindow .postMessage (vitepressData .isDark .value , href .value )
29- })
39+
40+ }
3041
3142function kebabToCamel(input : string ): string {
3243 return input .replace (/ -([a-z ] )/ g , (match , group ) => group .toUpperCase ());
You can’t perform that action at this time.
0 commit comments