Commit 879d233c by xinla

toggle 图标

1 parent 1ea4bfee
// 显隐侧边栏按钮 // 显隐侧边栏按钮
<template> <template>
<!-- <i class="el-icon-s-fold" :class="{ 'is-active': $store.state.app.sidebar.opened }" @click="toggleClick"></i> --> <!-- <i class="el-icon-s-fold" :class="{ 'open': $store.state.app.sidebar.opened }" @click="toggle"></i> -->
<svg-icon <!-- <svg-icon
iconClass="nested" iconClass="nested"
class="el-icon-s-fold" class="el-icon-s-fold"
:class="{ 'is-active': $store.state.app.sidebar.opened }" :class="{ 'open': $store.state.app.sidebar.opened }"
@click="toggleClick"></svg-icon> @click="toggle"></svg-icon> -->
<div class="toggle" :class="{ open: $store.state.app.sidebar.opened }" @click="toggle">
<div class="toggle-line"></div>
<div class="toggle-line line-middle"></div>
<div class="toggle-line"></div>
</div>
</template> </template>
<script> <script>
...@@ -20,7 +25,7 @@ export default { ...@@ -20,7 +25,7 @@ export default {
// }, // },
// }, // },
methods: { methods: {
toggleClick() { toggle() {
this.$store.dispatch('app/toggleSideBar') this.$store.dispatch('app/toggleSideBar')
}, },
}, },
...@@ -28,10 +33,37 @@ export default { ...@@ -28,10 +33,37 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.el-icon-s-fold { // .el-icon-s-fold {
font-size: 20px; // font-size: 20px;
&.is-active { // &.open {
transform: rotate(180deg); // transform: rotate(180deg);
// }
// }
.toggle {
position: relative;
cursor: pointer;
.toggle-line {
position: relative;
left: 0;
width: 18px;
height: 2px;
background: #4e5969;
border-radius: 8px;
transition: all 0.3s;
}
.line-middle {
position: relative;
margin: 4px 0;
left: -5px;
}
&.open {
.toggle-line {
// transform: rotateY(360deg);
left: 3px;
}
.line-middle {
left: 8px;
}
} }
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!