Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
onresize committed Apr 4, 2024
1 parent 870866e commit 0047073
Showing 1 changed file with 35 additions and 47 deletions.
82 changes: 35 additions & 47 deletions docs/.vuepress/layouts/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,50 +14,47 @@ const state = reactive({
onLinNum: 0
})
let loadScript, loadSakura, loadPopper
let popper = null, sakura = null
if (typeof globalThis?.document !== 'undefined') {
const themeConfig = {
shape: PopperShape.Star,
size: 1.75,
numParticles: 10,
}
const canvasOptions = {
opacity: 1,
zIndex: MAX_Z_INDEX,
}
const themeConfig = {
shape: PopperShape.Star,
size: 1.75,
numParticles: 10,
}
const el = document?.createElement('canvas')
el.id = 'moefy-canvas'
document?.body.appendChild(el)
const canvasOptions = {
opacity: 1,
zIndex: MAX_Z_INDEX,
}
loadScript = (url) => {
const script = document?.createElement('script')
script.type = 'text/javascript'
script.src = url
document?.head.appendChild(script)
}
const el = document?.createElement('canvas')
el.id = 'moefy-canvas'
document?.body.appendChild(el)
let popper = null, sakura = null
// 花瓣散落特效
loadSakura = () => {
popper?.unmount()
sakura = new Sakura({ numPatels: 30 }, canvasOptions)
sakura.mount(el)
}
const loadScript = (url) => {
const script = document?.createElement('script')
script.type = 'text/javascript'
script.src = url
document?.head.appendChild(script)
}
// 点击颗粒特效
loadPopper = () => {
if (popper) return
sakura?.unmount()
sakura = null
popper = new Popper(themeConfig, canvasOptions)
popper.mount(el)
}
// 花瓣散落特效
const loadSakura = () => {
popper?.unmount()
sakura = new Sakura({ numPatels: 30 }, canvasOptions)
sakura.mount(el)
}
loadPopper()
// 点击颗粒特效
const loadPopper = () => {
if (popper) return
sakura?.unmount()
sakura = null
popper = new Popper(themeConfig, canvasOptions)
popper.mount(el)
}
loadPopper()
const route = useRoute()
let routerPathArr = [encodeURI('/工作效率/HTML概览.html'), encodeURI('/工作效率/CSS概览.html')]
Expand All @@ -73,15 +70,6 @@ watch(() => route.path, async (val) => {
immediate: true
})
watch(() => globalThis.onlineUsers, (val) => {
// console.log('监听到用户在线数量变化:', val)
state.onLinNum = val
},
{
deep: true,
immediate: true
})
onMounted(() => { })
Expand All @@ -107,7 +95,7 @@ onUnmounted(() => {
<!-- <a href="https://onresize.github.io/web-blogs/rss.xml" title="订阅" target="_blank" class="icon-rss"></a> -->
<!-- 不蒜子访问量 -->
<div id="busuanzi_container_site_pv" class="visit-text">本站总访问量:<span id="busuanzi_value_site_pv">查询中</span></div>
<div id="busuanzi_container_site_pv" class="visit-text">本站总访问量:<span id="busuanzi_value_site_pv">0</span></div>
</div>
</template>
</ParentLayout>
Expand Down

0 comments on commit 0047073

Please sign in to comment.