安卓手机键盘会把fixed定位的东西顶上去 但ios正常

fixed定位在安卓手机上 当键盘抬起的时候会吧定位的内容顶上来在ios手机上没有问题 是因为两者对键盘的加载方式不同

解决办法:

<template>
   <img src="xxxxxx" alt="">
</template>

<script>
export default {
    data() {
        return {
            docmHeight: '',  //第一次获取高度
            nowHeight:'',
            hidshow:true,
            isResize:false
        };
    },
    watch: {
        // 如果 clientHeight 发生改变,这个函数就会运行
        nowHeight:function(){
            if(this.docmHeight  != this.nowHeight){
                this.hidshow=false
            }else{
                   this.hidshow=true
            }
        }
    },
    mounted() {
        // 获取浏览器可视区域高度
        this.docmHeight = document.documentElement.clientHeight; // document.body.clientWidth;
        window.onresize = ()=> { // 在窗口或框架被调整大小时触发
        return(()=>{

            this.nowHeight = document.documentElement.clientHeight;
            //  alert(this.clientHeight)
            console.log('当前高度',this.nowHeight);
        })()
        };
    },
    methods: {
      
    }
};
</script>



版权声明:本文为weixin_43617604原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。