refactor: ♻️ 收缩扩展左侧菜单栏按钮样式优化

Former-commit-id: 6e662422e09d53a090e6581f1cb5c217e31769a8
This commit is contained in:
郝先瑞
2023-10-19 22:28:13 +08:00
parent 37df504f7a
commit 31ffa0c3bb
2 changed files with 26 additions and 21 deletions

View File

@@ -0,0 +1 @@
<svg t="1697690769344" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7573" width="200" height="200"><path d="M128 192l0-64L896 128l0 64-768 0z m192 447.808l-192-128 192-128 0 256zM384 544l0-64L896 480l0 64-512 0zM128 896l0-64L896 832V896l-768 0z" fill="#464955" p-id="7574"></path></svg>

After

Width:  |  Height:  |  Size: 334 B

View File

@@ -1,18 +1,10 @@
<template>
<div
class="px-[15px] hover:bg-gray-50 cursor-pointer h-[50px] leading-[50px] dark:hover:bg-[var(--el-fill-color-light)]"
@click="toggleClick"
>
<svg
<div class="menu-toggle-button" @click="toggleClick">
<svg-icon
class="menu-toggle-button__icon"
:class="{ 'is-active': isActive }"
class="hamburger"
viewBox="0 0 1024 1024"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 0 0 0-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0 0 14.4 7z"
/>
</svg>
icon-class="shrink"
/>
</div>
</template>
@@ -32,15 +24,27 @@ function toggleClick() {
}
</script>
<style lang="scss" scoped>
.hamburger {
width: 20px;
height: 20px;
color: #fff;
vertical-align: -4px;
<style scoped lang="scss">
.menu-toggle-button {
display: flex;
align-items: center;
justify-content: center;
padding: 15px;
cursor: pointer;
transition: background-color 0.3s;
&.is-active {
transform: rotate(180deg);
:hover {
background-color: var(--el-fill-color);
}
&--active {
background-color: var(--el-fill-color-light);
}
&__icon {
&.is-active {
transform: rotate(180deg);
}
}
}
</style>