This commit is contained in:
KUN1007 2023-05-26 18:05:15 +08:00
parent 26bdc8dfd3
commit 38be23e3fc

View file

@ -2,25 +2,28 @@
// //
import { Icon } from '@iconify/vue' import { Icon } from '@iconify/vue'
// Vue // Vue
import { ref } from 'vue' import { ref, watch } from 'vue'
import AsideActive from './components/AsideActive.vue' import AsideActive from './components/AsideActive.vue'
import Aside from './components/Aside.vue' import Aside from './components/Aside.vue'
// //
// localStorage.setItem('KUNGalgameMainPageAsideBar', 'true') const asideBarStatus = (): boolean => {
// const asideBarStatus = if (localStorage.getItem('KUNGalgame-main-page-aside') === 'true') {
// localStorage.getItem('KUNGalgameMainPageAsideBar') || true return true
const isActive = ref(false)
const asideWidth = ref('40px')
const handleFold = () => {
if (isActive.value) {
asideWidth.value = '40px'
} else { } else {
asideWidth.value = '240px' return false
} }
}
const isActive = ref<boolean>(asideBarStatus())
const asideWidth = isActive.value ? '40px' : '240px'
const handleFold = () => {
isActive.value = !isActive.value isActive.value = !isActive.value
} }
watch(isActive, () => {
localStorage.setItem('KUNGalgame-main-page-aside', isActive.value.toString())
})
</script> </script>
<template> <template>