aside.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <el-menu
  3. @mouseenter.native="open_o"
  4. @mouseleave.native="close_s"
  5. default-active="1"
  6. class="el-menu-vertical-demo"
  7. @open="handleOpen"
  8. @close="handleClose"
  9. :collapse="Boolean(isCollapse)"
  10. :collapse-transition="false"
  11. unique-opened="true"
  12. mode="vertical"
  13. background-color="#545c64"
  14. text-color="#fff"
  15. >
  16. <div>
  17. <el-menu-item index="0" @click="open">
  18. <i class="el-icon-s-operation"></i>
  19. </el-menu-item>
  20. <el-submenu index="1">
  21. <template slot="title">
  22. <i class="el-icon-location"></i>
  23. <span slot="title">导航一</span>
  24. </template>
  25. <el-menu-item index="1-1-1">选项1-1</el-menu-item>
  26. <el-menu-item index="1-2-1">选项2-1</el-menu-item>
  27. <el-menu-item index="1-3-1">选项3-1</el-menu-item>
  28. </el-submenu>
  29. <el-submenu index="6" @click="open">
  30. <template slot="title">
  31. <i class="el-icon-location"></i>
  32. <span slot="title">导航一</span>
  33. </template>
  34. <el-submenu index="1-1">
  35. <span slot="title">选项1</span>
  36. <el-menu-item index="1-1-1">选项1-1</el-menu-item>
  37. </el-submenu>
  38. <el-submenu index="1-2">
  39. <span slot="title">选项2</span>
  40. <el-menu-item index="1-2-1">选项2-1</el-menu-item>
  41. </el-submenu>
  42. <el-submenu index="1-3">
  43. <span slot="title">选项3</span>
  44. <el-menu-item index="1-3-1">选项3-1</el-menu-item>
  45. </el-submenu>
  46. </el-submenu>
  47. </div>
  48. </el-menu>
  49. </template>
  50. <script>
  51. import { mapMutations , mapGetters} from "vuex";
  52. export default {
  53. data() {
  54. return {
  55. isCollapse: "asa",
  56. };
  57. },
  58. created() {},
  59. methods: {
  60. ...mapMutations(["changeZ","changeY"]),
  61. close_s(){
  62. console.log("ooooo")
  63. this.changeZ("width:1%");
  64. this.changeY("width:99%");
  65. this.isCollapse = "kik"
  66. },
  67. open_o(){
  68. this.changeZ("width:7%");
  69. this.changeY("width:93%");
  70. this.isCollapse = null
  71. },
  72. open() {
  73. if(this.isCollapse){
  74. console.log("opopop")
  75. this.changeZ("width:7%");
  76. this.changeY("width:93%");
  77. this.isCollapse = null
  78. }else{
  79. this.isCollapse = "lko"
  80. this.changeZ("width:1%");
  81. this.changeY("width:99%");
  82. }
  83. },
  84. handleOpen(key, keyPath) {},
  85. handleClose(key, keyPath) {},
  86. },
  87. };
  88. </script>
  89. <style>
  90. .el-menu-vertical-demo:not(.el-menu--collapse) {
  91. width: 200px;
  92. min-height: 400px;
  93. }
  94. </style>