You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
1.9 KiB

3 years ago
// index.js
// 获取应用实例
const app = getApp()
Page({
data: {
3 years ago
tabbar: {},
condition: ['二十四小时', '最近七天', '最近三十天', '自定义'],
toplist: [{
3 years ago
url: '',
title: '入库数据总量',
3 years ago
num: '1'
3 years ago
}, {
url: '',
title: '微博数据',
3 years ago
num: '2'
3 years ago
}, {
url: '',
title: '其他数据',
num: '0'
},
{
url: '',
title: '短视频数据',
num: '0'
},
{
url: '',
title: '微信数据',
num: '0'
},
{
url: '',
title: 'APP数据',
num: '0'
},
{
url: '',
title: '论坛数据',
num: '0'
},
{
url: '',
title: '新闻数据',
num: '0'
},
],
3 years ago
navData:[
3 years ago
{
3 years ago
text: '数据'
3 years ago
},
{
3 years ago
text: '事件'
3 years ago
},
{
3 years ago
text: '传播媒体'
3 years ago
},
{
3 years ago
text: '传播声量'
3 years ago
},
{
3 years ago
text: '晴雨表'
3 years ago
},
{
3 years ago
text: '租晴雨表房子'
3 years ago
},
3 years ago
],
currentTab: 0,
navScrollLeft: 0
3 years ago
3 years ago
},
3 years ago
switchNav(event){
// 获取当前tab 的id
var cur = event.currentTarget.dataset.current;
//每个tab选项宽度占1/5
var singleNavWidth = this.data.windowWidth / 5;
//tab选项居中
this.setData({
navScrollLeft: (cur - 2) * singleNavWidth
})
// 判断id是否和点击的tab id 一致
if (this.data.currentTab == cur) {
return false;
} else {
this.setData({
currentTab: cur
})
}
},
switchTab(event){
var cur = event.detail.current;
var singleNavWidth = this.data.windowWidth / 5;
this.setData({
currentTab: cur,
navScrollLeft: (cur - 2) * singleNavWidth
});
},
3 years ago
onShow() {
this.getTabBar().init();
3 years ago
},
3 years ago
onLoad: function (options) {
3 years ago
3 years ago
},
3 years ago
})