wx.getSystemInfo({success: function (res) {thisWidth = res.windowWidth;}}); that.setData({view_Width: thisWidth / ColIndex})//設置列寬 console.log('----------------------'); console.log('列數' + ColIndex + ' ; ' + '屏幕寬度:' + thisWidth + ';單元格寬度:' + thisWidth / ColIndex); console.log(requestarray[0].ArraylistData); that.setData({ array: requestarray[0].ArraylistData})//設置列寬
var thisWidth;//屏幕寬度 //創建節點選擇器 var query = wx.createSelectorQuery(); //選擇id query.select('#AutoTableItem').boundingClientRect() query.exec(function (res) { //res就是 所有標簽為mjltest的元素的信息 的數組 console.log(res); thisWidth = res[0].width; });