經過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