|
|
@@ -1,7 +1,7 @@
|
|
|
import React, { ReactNode } from 'react'
|
|
|
import { View } from '@tarojs/components'
|
|
|
import { TabBar, TabBarItem } from '@/components/ui/tab-bar'
|
|
|
-import { useRouter } from '@tarojs/taro'
|
|
|
+import Taro from '@tarojs/taro'
|
|
|
|
|
|
export interface TabBarLayoutProps {
|
|
|
children: ReactNode
|
|
|
@@ -32,21 +32,19 @@ const tabBarItems: TabBarItem[] = [
|
|
|
export const TabBarLayout: React.FC<TabBarLayoutProps> = ({ children, activeKey }) => {
|
|
|
const handleTabChange = (key: string) => {
|
|
|
// 使用 Taro 的导航 API 进行页面跳转
|
|
|
- import('@tarojs/taro').then(({ default: Taro }) => {
|
|
|
- switch (key) {
|
|
|
- case 'home':
|
|
|
- Taro.switchTab({ url: '/pages/index/index' })
|
|
|
- break
|
|
|
- case 'explore':
|
|
|
- Taro.switchTab({ url: '/pages/explore/index' })
|
|
|
- break
|
|
|
- case 'profile':
|
|
|
- Taro.switchTab({ url: '/pages/profile/index' })
|
|
|
- break
|
|
|
- default:
|
|
|
- break
|
|
|
- }
|
|
|
- })
|
|
|
+ switch (key) {
|
|
|
+ case 'home':
|
|
|
+ Taro.switchTab({ url: '/pages/index/index' })
|
|
|
+ break
|
|
|
+ case 'explore':
|
|
|
+ Taro.switchTab({ url: '/pages/explore/index' })
|
|
|
+ break
|
|
|
+ case 'profile':
|
|
|
+ Taro.switchTab({ url: '/pages/profile/index' })
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ break
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return (
|