<div tabindex="0" @blur="aside1_hide()" ref="aside1" class="aside" style="width: 200px; overflow: scroll;">
    <!-- background-color="#23303E" transparent -->
    <el-menu background-color="#23303E" text-color="#fff" active-text-color="#fff">
       ...
    </el-menu>
</div>
left_click: function() {
      if (!this.left_show) {
        this.$refs.aside1.style.left = "0"
        this.$refs.aside1.focus()  //获得焦点
        this.left_show = true
      } else {
        this.aside1_hide()
      }
},

aside1_hide:function () {
      this.$refs.aside1.style.left = "-200px"
      this.left_show = false
},

@media screen and (min-width: 1200px) {
  .aside {
    position: static;
    width: 200px;
    height: 100vh;
    margin: 0;
    padding: 0;
    background-color: #23303E;
    z-index: 100;
    /*移动时的过度效果*/
    transition: left 500ms ease;
    color: #fff;
  }
}

@media screen and (max-width: 1200px) {
  /*隐藏在左边*/
  .aside {
    position: fixed;
    /*相对于窗口固定定位*/
    top: 0;
    left: -200px;
    /*隐藏在左边*/
    width: 200px;
    height: 100vh;
    margin: 0;
    padding: 0;
    background-color: #23303E;
    z-index: 100;
    /*移动时的过度效果*/
    transition: left 500ms ease;

    /*padding: 36px;*/
    color: #fff;
  }
}
/*可以滚动,但隐藏滚动条*/
.aside::-webkit-scrollbar {
  display: none;
}

 

Logo

前往低代码交流专区

更多推荐