import {Tabbar} from '@nutui/nutui-react-taro'
import {Home, User, Date} from '@nutui/icons-react-taro'
import Taro from '@tarojs/taro'

function TabBar() {
    return (
        <Tabbar
            fixed
            onSwitch={(index) => {
                console.log(index)
                if (index == 0) {
                    Taro.switchTab({url: '/pages/index/index'})
                }
                if (index == 1) {
                    Taro.switchTab({url: '/pages/ai/index'})
                }
                if (index == 2) {
                    Taro.switchTab({url: '/pages/user/user'})
                }
            }}
            style={{
                display: 'none',
                zIndex: 100,
                backgroundColor: '#fff',
                boxShadow: '0 0 10px rgba(0, 0, 0, 0.1)',
            }}
        >
            <Tabbar.Item title="首页" icon={<Home size={18}/>}/>
            <Tabbar.Item title="AI问答" icon={<Date size={18}/>}/>
            <Tabbar.Item title="我的" icon={<User size={18}/>}/>
        </Tabbar>
    )
}

export default TabBar;
