CollapseIcon.vue 592 B

123456789101112131415161718192021222324252627
  1. <script setup lang="ts">
  2. import {Expand, Fold} from "@element-plus/icons-vue";
  3. import {useSystemStore} from "@/pinia/system-store";
  4. const systemStore = useSystemStore()
  5. const isCollapse = computed(() => systemStore.userConfig.isCollapse)
  6. const switchCollapse = () => {
  7. systemStore.setCollapse(!isCollapse.value)
  8. }
  9. </script>
  10. <template>
  11. <div class="collapse-icon"
  12. @click="switchCollapse">
  13. <el-icon>
  14. <Expand v-if="isCollapse"/>
  15. <Fold v-else/>
  16. </el-icon>
  17. </div>
  18. </template>
  19. <style lang="scss">
  20. .collapse-icon {
  21. font-size: 26px;
  22. cursor: pointer;
  23. }
  24. </style>