AsyncComponent, fold aside

This commit is contained in:
KUN1007 2023-05-21 22:15:27 +08:00
parent a3e418523e
commit 54a9046bec
2 changed files with 19 additions and 8 deletions

View file

@ -1,10 +1,6 @@
<script setup lang="ts">
//
// Vue
import { defineAsyncComponent } from 'vue'
const KUNGalgameSettingsPanel = defineAsyncComponent(
() => import('./setting-panel/KUNGalgameSettingPanel.vue')
)
//
import { Icon } from '@iconify/vue'
// vue
@ -17,6 +13,11 @@ import router from '@/router'
import { useSettingsPanelStore } from '@/store/modules/settings'
import { storeToRefs } from 'pinia'
//
const KUNGalgameSettingsPanel = defineAsyncComponent(
() => import('./setting-panel/KUNGalgameSettingPanel.vue')
)
// store
const settingsStore = useSettingsPanelStore()

View file

@ -4,16 +4,26 @@ import NewTopic from './topic/NewTopic.vue'
import HotTopic from './topic/HotTopic.vue'
//
import { Icon } from '@iconify/vue'
// Vue
import { ref } from 'vue'
//
const asideWidth = ref(240)
const asideWidthStyle = `${asideWidth.value}px`
const handleFold = () => {
asideWidth.value = 40
console.log(asideWidth.value)
}
</script>
<template>
<!-- 侧边栏 -->
<div class="aside">
<!-- 侧边栏交互 -->
<div class="nav-aside">
<div class="nav-aside" @click="handleFold">
<span>{{ asideWidth }}</span>
<!-- fa 箭头图标字体 -->
<Icon icon="line-md:arrow-left" />
折叠左侧区域
<span>折叠左侧区域</span>
</div>
<AsideItem />
<HotTopic />
@ -26,7 +36,7 @@ import { Icon } from '@iconify/vue'
.aside {
/* 侧边栏距离文章区域的距离 */
margin-right: 5px;
width: 240px;
width: v-bind('asideWidthStyle');
/* 侧边栏相对于整体可视部分的占比 */
/* 侧边栏高度 */
height: 100%;