手机端弹出菜单栏

html部分:

vue部分:

    export default {
  name: 'Header',
  data () {
    return {
      MenuBar: false
    }
  },
  methods: {
    toggler: function (e) {
      this.MenuBar =! this.MenuBar
    }
  },
  created: function () {
    let body = document.querySelector('body')
        body.addEventListener('click',(e)=>{
            console.log(e.target.id === 'menu_bar')         
        if(e.target.id === 'toggler-btn' || e.target.id === 'menu_bar'){
                this.MenuBar = true
        }else {
            this.MenuBar = false
        }
        },true)
  }
}
    ```

你可能感兴趣的:(手机端弹出菜单栏)