30 lines
604 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// pages/my/my.ts
Page({
data: {
currentTab: 2, // 当前选中的tab2表示"我的"页面
},
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时是当前页面不需要跳转
},
});