美文网首页
vue +cli3 input移动端兼容

vue +cli3 input移动端兼容

作者: 别怕我是好人_2837 | 来源:发表于2019-08-20 15:47 被阅读0次

1.首先清除input的默认样式

input, button, select, textarea {
  border:none; //清除边框
  outline:none;//清除默认边框线
  -webkit-appearance: none;//不让他像任何的其他标签
  border-radius: 0;//默认圆角
  -webkit-tap-highlight-color: transparent; // **点击背景高亮一闪 ios**
}
input:focus{ outline:none; }

2.安卓手机底部有使用position:fixed;底部被键盘托起

<button class="next-btn button" @click="nextStep" v-show="hidshow">下一步</button>

data () {
    return {
      hidshow: true,
    }
} 
mounted () {
    // 解决安卓机型底部被输入框顶起问题,因为ios上正常所以判断手机系统
    //要用真机调试.浏览器的判断手机系统不精确
    const ua = window.navigator.userAgent
    if (ua.indexOf('Android') > -1 || ua.indexOf('Linux') > -1) {
      const docmHeight = document.body.clientHeight// 默认屏幕高度
      window.onresize = () => {
        var nowHeight = document.body.clientHeight// 实时屏幕高度
        if (docmHeight !== nowHeight) {
          this.hidshow = false
        } else {
          this.hidshow = true
        }
      }
    }
  },

3.ios底部空白(这个具体我没测到,之前好像发生过,没那么多手机测)

 <input type="text" placeholder="示例: " v-model="params.name" @blur="inputLoseFocus">

 // ios兼容问题
    inputLoseFocus () {
      window.scrollTo(0, 0)
    }

相关文章

  • vue +cli3 input移动端兼容

    1.首先清除input的默认样式 2.安卓手机底部有使用position:fixed;底部被键盘托起 3.ios底...

  • 随笔小记

    移动端 滑动流畅 input 等兼容汇总 伪元素表单控件默认样式重置与自定义大全 去掉原生的 input[type...

  • H5随笔

    H5兼容VIdeo H5让兼容安卓和IOS调用相机 移动端debug input file 拍照上传IOS图片旋转...

  • 如何在Vue项目中使用vw实现移动端适配

    Vue项目中使用vw实现移动端适配 我们在vue移动端项目中的适配一般都采用rem,但是rem也不是能兼容所有的终...

  • vue 使用lib-flexible、px2rem-loader

    使用vue开发移动端 开发移动端就必须的考虑各种手机屏幕的兼容适配问题了,这里使用lib-flexible、px2...

  • 2018-07-27

    1、移动端遇到的兼容问题? 1 input框输入问题 最开始在input输入框中,也会习惯性的写上linehei...

  • 移动端兼容性问题解决方案

    转:移动端兼容

  • Vue + Webpack

    Vue(适合移动端的项目,特点小巧,不兼容ie)https://cn.vuejs.org(官网) 基础代码(声明式...

  • 拼图滑块验证-vue优兼容组件

    功能概述 制作一个vue组件,拼图验证,兼容移动端,PC端,成功或失败可调用不同的回调函数。数据驱动,不需...

  • 99、关于ant design vue使用polyfill在ie

    最近使用cli3搭建ant design vue ui框架时发现项目在ie上不兼容,就引入@babel/polyf...

网友评论

      本文标题:vue +cli3 input移动端兼容

      本文链接:https://www.haomeiwen.com/subject/ceepsctx.html