mirror of
https://github.com/ZiuChen/ZiuChen.github.io.git
synced 2025-08-17 23:19:55 +08:00
fix: 调整代码执行细节
This commit is contained in:
parent
0e9a487660
commit
d9efebeb90
@ -1,7 +1,7 @@
|
|||||||
import type { EnhanceAppContext } from 'vitepress'
|
import type { EnhanceAppContext } from 'vitepress'
|
||||||
import DefaultTheme from 'vitepress/theme'
|
import DefaultTheme from 'vitepress/theme'
|
||||||
import { nextTick, watchEffect } from 'vue'
|
import { nextTick, watch } from 'vue'
|
||||||
import { inBrowser, useRouter } from 'vitepress'
|
import { inBrowser, useRoute } from 'vitepress'
|
||||||
import mediumZoom from 'medium-zoom'
|
import mediumZoom from 'medium-zoom'
|
||||||
|
|
||||||
import Title from '../components/Title.vue'
|
import Title from '../components/Title.vue'
|
||||||
@ -21,11 +21,15 @@ export default {
|
|||||||
app.component('ImgSlider', ImgSlider)
|
app.component('ImgSlider', ImgSlider)
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const router = useRouter()
|
const route = useRoute()
|
||||||
watchEffect(() => {
|
watch(
|
||||||
// 将router.route.path作为依赖收集 首次访问即添加监听
|
() => route.path,
|
||||||
const path = router.route.path
|
() => {
|
||||||
nextTick(() => (inBrowser ? mediumZoom('.main img', { background: 'var(--vp-c-bg)' }) : null))
|
nextTick(() =>
|
||||||
})
|
inBrowser ? mediumZoom('.main img', { background: 'var(--vp-c-bg)' }) : null
|
||||||
|
)
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user