2024獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>
在app.js中獲取到設(shè)備寬高
// 設(shè)備信息
wx.getSystemInfo({success: function(res) {that.screenWidth = res.windowWidth;that.screenHeight = res.windowHeight;that.pixelRatio = res.pixelRatio;}
});
然后挖坑在布局頁(yè)面
最后在js中實(shí)現(xiàn)數(shù)值
setImageWidth: function () {var screenWidth = getApp().screenWidth;var imageWidth = (screenWidth - 130) / 3;this.setData({imageWidth: imageWidth});
},
setSideHeight: function () {this.setData({sidebarHeight: getApp().screenHeight});
},
如圖:
源碼下載:http://git.oschina.net/dotton/lendoo-wx,本文涉及代碼存于/pages/category/category文件夾中。愛(ài)掏網(wǎng) - it200.com
對(duì)移動(dòng)開(kāi)發(fā)有興趣的朋友可以關(guān)注我的公眾號(hào)【huangxiujie85】與我交流討論,給我留言或文章評(píng)論。愛(ài)掏網(wǎng) - it200.com
轉(zhuǎn):https://my.oschina.net/huangxiujie/blog/831154