https://taro-ui.aotu.io/#/doc...
上面是文档
import Taro from '@tarojs/taro'
import { AtTabBar } from 'taro-ui'
export default class Index extends Taro.Component {
constructor () {
super(...arguments)
this.state = {
current: 0
}
}
handleClick (value) {
this.setState({
current: value
})
}
render () {
return (
<AtTabBar
tabList={[
{ title: '待办事项', text: 8 },
{ title: '拍照' },
{ title: '通讯录', dot: true }
]}
onClick={this.handleClick.bind(this)}
current={this.state.current}
/>
)
}
}
根据上面的 示例代码。 点击tab 后, 改变的是 current 的数值,
我可以通过 current 的数值 来判断 显示哪一各组件,是吗
或者有更好的实现吗
官方有自带的tabBar,在APP.js配置一下tabBar就可以