vue移动端安卓软键盘弹出底部按钮顶起

<div class="bottom" v-show="hideshow">
  <div class="btn">
  </div>
</div>


data() {
    return {
        docmHeight: document.documentElement.clientHeight ||document.body.clientHeight,
        showHeight: document.documentElement.clientHeight ||document.body.clientHeight,
        hideshow:true  //显示或者隐藏footer
    }
  },

mounted() {
      //监听事件
      window.onresize = ()=>{
          return(()=>{
              this.showHeight = document.documentElement.clientHeight || document.body.clientHeight;
      })()
      }
 
  },

beforeDestroy() {
    window.onresize = () => {}
},

watch: {
        //监听显示高度
      showHeight:function() {
          if(this.docmHeight > this.showHeight){
            //隐藏
              this.hideshow=false
          }else{
            //显示
              this.hideshow=true
          }
      }
  },

 

posted @ 2022-03-15 10:26  小那  阅读(446)  评论(0编辑  收藏  举报