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.
49 lines
1.2 KiB
49 lines
1.2 KiB
// pages/agent/index/index.js
|
|
const app = getApp()
|
|
|
|
Page({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
height: app.globalData.fragmentHeight,
|
|
CustomBar: app.globalData.CustomBar,
|
|
TabList: [
|
|
{ index: 0, value: 'focus', name: '关注' },
|
|
{ index: 1, value: 'factory', name: '全部' }
|
|
],
|
|
pageIndex: 0,
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.setData({
|
|
height: app.globalData.fragmentHeight,
|
|
StatusBar: app.globalData.StatusBar || 40,
|
|
CustomBar: app.globalData.CustomBar || (app.globalData.isIos ? 64 : 80),
|
|
})
|
|
},
|
|
backspace() {
|
|
wx.navigateBack()
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
var pageView = this.selectComponent('#' + this.data.TabList[this.data.pageIndex].value)
|
|
if (pageView) {
|
|
pageView.onRestart()
|
|
}
|
|
},
|
|
stopTouchMove: function (e) {
|
|
return false
|
|
},
|
|
onTabChangeTop: function (e) {
|
|
if (this.data.pageIndex == Number(e.currentTarget.dataset.index)) {
|
|
return
|
|
}
|
|
this.setData({ pageIndex: Number(e.currentTarget.dataset.index) })
|
|
this.onShow()
|
|
}
|
|
})
|