getElSize(id) { //得到元素的size return new Promise((res, rej) => { uni.createSelectorQuery().select('#' + id).fields({ size: true, scrollOffset: true }, (data) => { res(data); }).exec(); });},
// 异步调用async tapTab(index) { //点击tab-bar if (this.tabIndex === index) { return false; } else { let tabBar = await this.getElSize("tab-bar"), console.log(tabBar) } },