经过API可获取的值:动画
1 // 在 iPhone6 下运行: 2 var systemInfo = wx.getSystemInfoSync(); 3 console.log(systemInfo.windowWidth); // 输出 375(单位 px) 4 // 在 iPhone6 Plus 下: 5 var systemInfo = wx.getSystemInfoSync(); 6 console.log(systemInfo.windowWidth); // 输出 414 (单位 px)
1 // 假设设计图中按钮向右偏移了300rpx,动画代码以下: 2 this.animation.translateX(300 / 750 * systemInfo.windowWidth).step()
这样在全部机型上均可以进行适配。this