|
|
@@ -1,7 +1,7 @@
|
|
|
import { View, ScrollView, Text } from '@tarojs/components'
|
|
|
import { useInfiniteQuery } from '@tanstack/react-query'
|
|
|
-import { useState, useEffect } from 'react'
|
|
|
-import Taro, { usePullDownRefresh, useReachBottom } from '@tarojs/taro'
|
|
|
+import { useState } from 'react'
|
|
|
+import Taro, { usePullDownRefresh, useReachBottom, useRouter } from '@tarojs/taro'
|
|
|
import { orderClient } from '@/api'
|
|
|
import { InferResponseType } from 'hono'
|
|
|
import { Navbar } from '@/components/ui/navbar'
|
|
|
@@ -34,14 +34,14 @@ export default function OrderListPage() {
|
|
|
const { user } = useAuth()
|
|
|
const [activeTab, setActiveTab] = useState('all')
|
|
|
|
|
|
- // 处理URL参数
|
|
|
- useEffect(() => {
|
|
|
- const currentInstance = Taro.getCurrentInstance()
|
|
|
- const params = currentInstance.router?.params
|
|
|
- if (params?.tab) {
|
|
|
- setActiveTab(params.tab)
|
|
|
- }
|
|
|
- }, [])
|
|
|
+ // 使用useRouter钩子获取路由参数
|
|
|
+ const router = useRouter()
|
|
|
+ const params = router.params
|
|
|
+
|
|
|
+ // 初始化标签状态
|
|
|
+ if (params?.tab && activeTab !== params.tab) {
|
|
|
+ setActiveTab(params.tab)
|
|
|
+ }
|
|
|
|
|
|
const {
|
|
|
data,
|