vue 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;
}

 

你可能感兴趣的:(css)