|
|
|
@ -314,6 +314,7 @@ |
|
|
|
query.exec( |
|
|
|
function(res) { |
|
|
|
this.tabQueryInfo = res; |
|
|
|
//console.log(res) |
|
|
|
// 初始化滚动条和移动bar的位置 |
|
|
|
this.scrollByIndex(); |
|
|
|
}.bind(this) |
|
|
|
@ -322,9 +323,11 @@ |
|
|
|
// 滚动scroll-view,让活动的tab处于屏幕的中间位置 |
|
|
|
scrollByIndex() { |
|
|
|
// 当前活动tab的布局信息,有tab菜单的width和left(为元素左边界到父元素左边界的距离)等信息 |
|
|
|
let tabInfo = this.tabQueryInfo[this.currentIndex]; |
|
|
|
console.log('tabInfo') |
|
|
|
console.log(this.currentIndex) |
|
|
|
console.log(this.tabQueryInfo) |
|
|
|
let tabInfo = this.tabQueryInfo[this.currentIndex]; |
|
|
|
|
|
|
|
if (!tabInfo) return; |
|
|
|
// 活动tab的宽度 |
|
|
|
let tabWidth = tabInfo.width; |
|
|
|
|