ts新手,很头大啊,大佬们帮忙看看
代码如下
import React, { useState } from 'react';
import PropTypes from 'prop-types'
import { TabBar } from 'zarm';
import { useNavigate } from 'react-router-dom';
import s from './style.module.less';
interface NavBarProps {
showNav: boolean
}
const NavBar = ({ showNav }: NavBarProps) => {
const [activeKey, setActiveKey] = useState<string>('/');
const navigate = useNavigate()
const changeTab = (path?: number | string) => {
setActiveKey(path as string)
navigate(path as string)
}
return (
<TabBar visible={showNav} className={s.tab} activeKey={activeKey} onChange={changeTab}>
<TabBar.Item
itemKey="/"
title="账单"
/>
<TabBar.Item
itemKey="/data"
title="统计"
/>
<TabBar.Item
itemKey="/user"
title="我的"
/>
</TabBar>
)
}
NavBar.propTypes = {
showNav: PropTypes.bool
}
export default NavBar;
报错提示
你把
className
属性删了试试,TabBar
不支持这个属性