修复bug
This commit is contained in:
@@ -7,6 +7,7 @@ import CustomNavbar from "@/components/CustomNavbar";
|
||||
import { Input } from "@nutui/nutui-react-taro";
|
||||
import Taro from "@tarojs/taro";
|
||||
import "./index.scss";
|
||||
import { getCurrentFullPath } from "@/utils";
|
||||
|
||||
interface IProps {
|
||||
config?: {
|
||||
@@ -40,10 +41,8 @@ const ListHeader = (props: IProps) => {
|
||||
const currentAddress = city + district
|
||||
|
||||
const handleInputClick = () => {
|
||||
const pages = Taro.getCurrentPages();
|
||||
const currentPage = pages[pages.length - 1];
|
||||
const currentPagePath = currentPage.route;
|
||||
if (currentPagePath === "game_pages/searchResult/index") {
|
||||
const currentPagePath = getCurrentFullPath()
|
||||
if (currentPagePath === "/game_pages/searchResult/index") {
|
||||
Taro.navigateBack();
|
||||
} else {
|
||||
Taro.navigateTo({
|
||||
@@ -54,6 +53,13 @@ const ListHeader = (props: IProps) => {
|
||||
|
||||
// 点击logo
|
||||
const handleLogoClick = () => {
|
||||
// 如果当前在列表页,点击后页面回到顶部
|
||||
if (getCurrentFullPath() === "/game_pages/list/index") {
|
||||
Taro.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300,
|
||||
});
|
||||
}
|
||||
Taro.redirectTo({
|
||||
url: "game_pages/list/index", // 列表页
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user