微信小程序中的iOS兼容性问题

记录下在微信小程序中遇到的一些兼容性问题,iOS兼容性

1.iOS中input的placeholder属性字体不居中

  • 对placeholder设置line-height及font-size
  • 对input设置高度

2.iOS中滚动卡顿

  • 设置-webkit-overflow-scrolling:touch;

3.微信小程序中解决iOS中new Date() 时间格式不兼容

  • 在实现倒计时,根据后台返回的时间格式转换时,后台返回了时间格式为”2018-11-12 11:12:11”,然后利用new Date() 转换时,iOS中无法展示,安卓中显示正常
let time = '2018-12-10 11:11:11';
let temporaryTime1 = new Date(time);
this.setData({
   timeRemain1: temporaryTime1,
})
/* 利用正则表达式替换时间中的”-”为”/”即可 */
let time = '2018-12-10 11:11:11';
let temporaryTime = new Date(time.replace(/-/g,'/'));
let temporaryTime1 = new Date(time);
this.setData({
    timeRemain: temporaryTime,
    timeRemain1: temporaryTime1,
 })

4. 微信小程序scroll-view隐藏滚动条方法

  • 在wxss里加入以下代码:
::-webkit-scrollbar{
width: 0;
height: 0;
color: transparent;
}

猜你喜欢

转载自blog.csdn.net/ZJW222/article/details/83545635