Ionic2,内容宽度和高度显示为0
我正在使用Ionic2作为混合应用程序。我有一个要求,我需要内容区域(离子内容)的高度+宽度 我正在努力Ionic2,内容宽度和高度显示为0,ionic2,Ionic2,我正在使用Ionic2作为混合应用程序。我有一个要求,我需要内容区域(离子内容)的高度+宽度 我正在努力 @ViewChild(Content)Content:Content; log(this.content.contentWidth、this.content.contentHeight) 这是给0,0 当我尝试console.log(this.content.getContentDimensions())时 它给 {"contentHeight":null,"contentWidth":5
@ViewChild(Content)Content:Content;
log(this.content.contentWidth、this.content.contentHeight)
这是给0,0
当我尝试console.log(this.content.getContentDimensions())时代码>
它给
{"contentHeight":null,"contentWidth":525,"contentLeft":0,"scrollHeight":1023,"scrollTop":0,"scrollWidth":510,"scrollLeft":0}
如何获取离子内容(可视区域)的宽度和高度。试试这个
ionViewDidLoad() {
setTimeout(() => {
console.log("some....",this.content.contentHeight);
this.contentHeight = this.content.contentHeight;
console.log("some....",this.contentHeight);
}, 10);
}