30 lines
604 B
TypeScript
30 lines
604 B
TypeScript
// pages/my/my.ts
|
||
Page({
|
||
data: {
|
||
currentTab: 2, // 当前选中的tab,2表示"我的"页面
|
||
},
|
||
|
||
onLoad() {
|
||
// 页面加载时的逻辑
|
||
},
|
||
|
||
switchTab(e: any) {
|
||
const index = parseInt(e.currentTarget.dataset.index);
|
||
this.setData({
|
||
currentTab: index,
|
||
});
|
||
|
||
// 实际项目中这里应该跳转到对应页面
|
||
if (index === 0) {
|
||
wx.redirectTo({
|
||
url: "/pages/index/index",
|
||
});
|
||
} else if (index === 1) {
|
||
wx.redirectTo({
|
||
url: "/pages/credit/credit",
|
||
});
|
||
}
|
||
// index为2时是当前页面,不需要跳转
|
||
},
|
||
});
|