1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- // pages/teacher/index/index.ts
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- tabJson: [{ icon: "../../image/teacher/monitor.png", selectedIcon: "../../image/teacher/monitor_selected.png", title: "监控" },
- { icon: "../../image/teacher/file.png", selectedIcon: "../../image/teacher/file_selected.png", title: "文件库" },
- { icon: "../../image/teacher/fault.png", selectedIcon: "../../image/teacher/fault_selected.png", title: "报修" },
- { icon: "../../image/teacher/my.png", selectedIcon: "../../image/teacher/my_selected.png", title: "我的" }
- ],
- currPageIndex: 0
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad() {
- console.log(this.data.tabJson)
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- //禁止用户手滑选项卡
- catchTouchMove: function () {
- return false
- },
- //选项卡滑动
- selectItemIndex: function (event: any) {
- console.log("click selected", event.detail.selectIndex)
- let titleName = "";
- switch (Number(event.detail.selectIndex)) {
- case 0:
- titleName = "开始上课"
- break;
- case 1:
- titleName = "文件库"
- break;
- case 2:
- titleName = "故障报修"
- break;
- case 3:
- titleName = "我的"
- break;
- }
- wx.setNavigationBarTitle({
- title: titleName
- })
- this.setData({
- currPageIndex: Number(event.detail.selectIndex)
- })
- }
- })
|