MenuStretchBar.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <el-tooltip content="显示/隐藏 菜单记录" placement="top">
  3. <div class="header-icon-bar" @click="toMenuBarShowClick">
  4. <HcIcon :class="menuBarShow?'text-main':''" :fill="menuBarShow" class="header-icon" name="apps"/>
  5. </div>
  6. </el-tooltip>
  7. </template>
  8. <script setup>
  9. import {ref, watch} from "vue";
  10. import {useAppStore} from "~src/store";
  11. //初始化变量
  12. const useAppState = useAppStore()
  13. const menuBarShow = ref(useAppState.menuBarShow)
  14. //监听
  15. watch(() => [
  16. useAppState.menuBarShow
  17. ], ([show]) => {
  18. menuBarShow.value = show
  19. })
  20. const toMenuBarShowClick = () => {
  21. useAppState.menuBarShow = !menuBarShow.value
  22. }
  23. </script>
  24. <style lang="scss" scoped>
  25. .header-icon-bar {
  26. position: relative;
  27. height: 40px;
  28. width: 40px;
  29. border-radius: 100px;
  30. display: flex;
  31. justify-content: center;
  32. align-items: center;
  33. cursor: pointer;
  34. margin-right: 30px;
  35. font-size: 26px;
  36. border: 1px solid #00000000;
  37. background: #f1f5f8;
  38. color: #202532;
  39. box-shadow: var(--hc-shadow);
  40. }
  41. .hc-layout-box .hc-container-view.home .hc-header-view .hc-header-content .header-icon-bar {
  42. border: 1px solid white;
  43. color: inherit;
  44. box-shadow: initial;
  45. background: initial;
  46. }
  47. </style>