小程序
小游戏
企业微信
微信支付
扫描小程序码分享
比如这样,默认选中第5项
1 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
active-tab设置为4
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
calcHeight: function calcHeight() {
var length = this.data.vtabs.length;
var _contentHeight = this.data._contentHeight;
var _heightRecords = [];
var temp = 0;
for (var i = 0; i < length; i++) {
_heightRecords[i] = temp + (_contentHeight[i] || 0);
temp = _heightRecords[i];
}
this.data._heightRecords = _heightRecords;
this.scrollTabBar(this.data.activeTab);
},
scrollTabBar: function scrollTabBar(index) {
var len = this.data.vtabs.length;
if (len === 0) return;
var currentView = index < 6 ? 0 : index - 5;
if (currentView >= len) currentView = len - 1;
var _heightRecords = this.data._heightRecords;
var contentScrollTop = _heightRecords[index - 1] || 0;
this.setData({
currentView,
contentScrollTop
});
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
active-tab设置为4
calcHeight: function calcHeight() {
var length = this.data.vtabs.length;
var _contentHeight = this.data._contentHeight;
var _heightRecords = [];
var temp = 0;
for (var i = 0; i < length; i++) {
_heightRecords[i] = temp + (_contentHeight[i] || 0);
temp = _heightRecords[i];
}
this.data._heightRecords = _heightRecords;
this.scrollTabBar(this.data.activeTab);
},
scrollTabBar: function scrollTabBar(index) {
var len = this.data.vtabs.length;
if (len === 0) return;
var currentView = index < 6 ? 0 : index - 5;
if (currentView >= len) currentView = len - 1;
var _heightRecords = this.data._heightRecords;
var contentScrollTop = _heightRecords[index - 1] || 0;
this.setData({
currentView,
contentScrollTop
});
},