安卓和ios的兼容

1、时间戳

问题
安卓系统 Date.parse(new Date(‘2018-03-30 12:00:00’))会直接转换成时间戳的形式(简单说就是整数形式),ios转换不了
解决方法
ios系统下日期之间使用 / 连接
Date.parse(new Date(‘2018/03/30 12:00:00’))

Date.parse(new Date('2018/03/30 12:00:00')) || Date.parse(new Date('2018-03-30 12:00:00'))

2、input框聚焦

问题
ios出现outline或者阴影,安卓显示正常
解决方法

input:focus{outline:none}
input:{-webkit-appearance: none;}

3、关于flex布局

问题
flex布局对于低版本的安卓,不支持flex-wrap:wrap属性,但是ios系统支持换行属性
解决方法
如果你的布局必须要用到换行,那就在外层包裹一个大的div,然后设置几个小div,每个小div的布局都是flex(但是不换行哦);

4、ios系统,会将数字当成电话号码,导致变色

<meta name="format-detection" content="telephone=no"> 
<meta http-equiv="x-rim-auto-match" content="none">

5、禁止安卓识别email

<meta content="email=no" name="format-detection" />

input 的placeholder属性会使文本位置偏上

line-height: (和input框的高度一样高)---pc端解决方法
line-height:normal ---移动端解决方法

input type=number之后,pc端出现上下箭头

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0;
}

ios图片不显示问题

有些图片在安卓可以正常显示,而在ios则不显示,因为原图片格式为webp,人为修改后缀成png后则ios不显示。

音频自动播放问题,ios默认不自动播放

猜你喜欢

转载自blog.csdn.net/weixin_43848576/article/details/86547104