1
This commit is contained in:
@@ -7,7 +7,7 @@ import PublishMenu from "../PublishMenu";
|
||||
export type currentPageType = "games" | "message" | "personal";
|
||||
|
||||
const GuideBar = (props) => {
|
||||
const { currentPage, guideBarClassName, onPublishMenuVisibleChange } = props;
|
||||
const { currentPage, guideBarClassName, onPublishMenuVisibleChange, onTabChange } = props;
|
||||
|
||||
const guideItems = [
|
||||
{
|
||||
@@ -34,7 +34,14 @@ const GuideBar = (props) => {
|
||||
if (code === currentPage) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果提供了 onTabChange 回调,优先使用(单页面模式)
|
||||
if (onTabChange) {
|
||||
onTabChange(code);
|
||||
return;
|
||||
}
|
||||
|
||||
// 否则使用路由跳转(兼容模式)
|
||||
let url = `/pages/${code}/index`;
|
||||
if (code === "personal") {
|
||||
url = "/user_pages/myself/index";
|
||||
@@ -48,7 +55,7 @@ const GuideBar = (props) => {
|
||||
Taro.redirectTo({
|
||||
url: url,
|
||||
}).then(() => {
|
||||
Taro.pageScrollTo({
|
||||
(Taro as any).pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user