伸缩效果不对
来源:2-4 伸缩菜单-完成伸缩菜单基本功能
n37r09u3
2021-12-20
<template>
<el-container>
<el-aside width="200px">
<el-menu
:collapse="isCollapse"
default-active="1"
class="el-menu-aside"
>
<el-menu-item index="1">
<el-icon>
<el-icon-menu/>
</el-icon>
<span>菜单 1</span>
</el-menu-item>
<el-menu-item index="2">
<el-icon>
<el-icon-menu/>
</el-icon>
<span>菜单 2</span>
</el-menu-item>
<el-menu-item index="3">
<el-icon>
<el-icon-menu/>
</el-icon>
<span>菜单 3</span>
</el-menu-item>
</el-menu>
</el-aside>
<el-container>
<el-header>
<span @click="toggle">
<el-icon-expand v-if="isCollapse"></el-icon-expand>
<el-icon-fold v-else></el-icon-fold>
</span>
</el-header>
<el-main>
<router-view></router-view>
</el-main>
</el-container>
</el-container>
</template>
<script setup lang="ts">
import {ref} from 'vue'
let isCollapse = ref(false)
let toggle = () => {
isCollapse.value = !isCollapse.value
}
</script>
<style lang="scss" scoped>
</style>
点击后把整个菜单都隐藏了 菜单的图标都消失了
单纯赋值 效果是对的 很奇怪
let isCollapse = ref(false)
let isCollapse = ref(true)
写回答
3回答
-
五月的夏天
2021-12-20
auto。
00 -
五月的夏天
2021-12-20
el-aside的宽度不能写死哈,需要给auti。
00 -
n37r09u3
提问者
2021-12-20
00
相似问题