|
@@ -13,6 +13,7 @@ class App extends Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
|
|
+ let {selectedTab} = this.state;
|
|
|
return (
|
|
return (
|
|
|
<div style={{
|
|
<div style={{
|
|
|
position: 'fixed',
|
|
position: 'fixed',
|
|
@@ -28,79 +29,37 @@ class App extends Component {
|
|
|
<TabBar.Item
|
|
<TabBar.Item
|
|
|
title="首页"
|
|
title="首页"
|
|
|
key="home"
|
|
key="home"
|
|
|
- icon={<div style={{
|
|
|
|
|
- width: '22px',
|
|
|
|
|
- height: '22px',
|
|
|
|
|
- background: 'url(https://zos.alipayobjects.com/rmsportal/sifuoDUQdAFKAVcFGROC.svg) center center / 21px 21px no-repeat'
|
|
|
|
|
- }}
|
|
|
|
|
- />
|
|
|
|
|
- }
|
|
|
|
|
- selectedIcon={<div style={{
|
|
|
|
|
- width: '22px',
|
|
|
|
|
- height: '22px',
|
|
|
|
|
- background: 'url(https://zos.alipayobjects.com/rmsportal/iSrlOTqrKddqbOmlvUfq.svg) center center / 21px 21px no-repeat'
|
|
|
|
|
- }}
|
|
|
|
|
- />
|
|
|
|
|
- }
|
|
|
|
|
- selected={this.state.selectedTab === 'home'}
|
|
|
|
|
|
|
+ icon={<HomeUnselectedIcon/>}
|
|
|
|
|
+ selectedIcon={<HomeSelectedIcon/>}
|
|
|
|
|
+ selected={selectedTab === 'home'}
|
|
|
onPress={() => {
|
|
onPress={() => {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
selectedTab: 'home',
|
|
selectedTab: 'home',
|
|
|
})
|
|
})
|
|
|
}}
|
|
}}
|
|
|
- data-seed="logId"
|
|
|
|
|
>
|
|
>
|
|
|
<Home/>
|
|
<Home/>
|
|
|
</TabBar.Item>
|
|
</TabBar.Item>
|
|
|
<TabBar.Item
|
|
<TabBar.Item
|
|
|
- icon={
|
|
|
|
|
- <div style={{
|
|
|
|
|
- width: '22px',
|
|
|
|
|
- height: '22px',
|
|
|
|
|
- background: 'url(https://gw.alipayobjects.com/zos/rmsportal/BTSsmHkPsQSPTktcXyTV.svg) center center / 21px 21px no-repeat'
|
|
|
|
|
- }}
|
|
|
|
|
- />
|
|
|
|
|
- }
|
|
|
|
|
- selectedIcon={
|
|
|
|
|
- <div style={{
|
|
|
|
|
- width: '22px',
|
|
|
|
|
- height: '22px',
|
|
|
|
|
- background: 'url(https://gw.alipayobjects.com/zos/rmsportal/ekLecvKBnRazVLXbWOnE.svg) center center / 21px 21px no-repeat'
|
|
|
|
|
- }}
|
|
|
|
|
- />
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ icon={<CartUnselectedIcon/>}
|
|
|
|
|
+ selectedIcon={<CartSelectedIcon/>}
|
|
|
title="购物车"
|
|
title="购物车"
|
|
|
key="cart"
|
|
key="cart"
|
|
|
- selected={this.state.selectedTab === 'cart'}
|
|
|
|
|
|
|
+ selected={selectedTab === 'cart'}
|
|
|
onPress={() => {
|
|
onPress={() => {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
selectedTab: 'cart',
|
|
selectedTab: 'cart',
|
|
|
})
|
|
})
|
|
|
}}
|
|
}}
|
|
|
- data-seed="logId1"
|
|
|
|
|
>
|
|
>
|
|
|
<Cart/>
|
|
<Cart/>
|
|
|
</TabBar.Item>
|
|
</TabBar.Item>
|
|
|
<TabBar.Item
|
|
<TabBar.Item
|
|
|
- icon={
|
|
|
|
|
- <div style={{
|
|
|
|
|
- width: '22px',
|
|
|
|
|
- height: '22px',
|
|
|
|
|
- background: 'url(https://zos.alipayobjects.com/rmsportal/psUFoAMjkCcjqtUCNPxB.svg) center center / 21px 21px no-repeat'
|
|
|
|
|
- }}
|
|
|
|
|
- />
|
|
|
|
|
- }
|
|
|
|
|
- selectedIcon={
|
|
|
|
|
- <div style={{
|
|
|
|
|
- width: '22px',
|
|
|
|
|
- height: '22px',
|
|
|
|
|
- background: 'url(https://zos.alipayobjects.com/rmsportal/IIRLrXXrFAhXVdhMWgUI.svg) center center / 21px 21px no-repeat'
|
|
|
|
|
- }}
|
|
|
|
|
- />
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ icon={<MyUnselectedIcon/>}
|
|
|
|
|
+ selectedIcon={<MySelectedIcon/>}
|
|
|
title="我的"
|
|
title="我的"
|
|
|
key="my"
|
|
key="my"
|
|
|
- selected={this.state.selectedTab === 'my'}
|
|
|
|
|
|
|
+ selected={selectedTab === 'my'}
|
|
|
onPress={() => {
|
|
onPress={() => {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
selectedTab: 'my',
|
|
selectedTab: 'my',
|
|
@@ -115,4 +74,52 @@ class App extends Component {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export default App
|
|
|
|
|
|
|
+export default App
|
|
|
|
|
+
|
|
|
|
|
+const HomeUnselectedIcon = () => (
|
|
|
|
|
+ <div style={{
|
|
|
|
|
+ width: '22px',
|
|
|
|
|
+ height: '22px',
|
|
|
|
|
+ background: 'url(https://zos.alipayobjects.com/rmsportal/sifuoDUQdAFKAVcFGROC.svg) center center / 21px 21px no-repeat'
|
|
|
|
|
+ }}/>
|
|
|
|
|
+)
|
|
|
|
|
+
|
|
|
|
|
+const HomeSelectedIcon = () => (
|
|
|
|
|
+ <div style={{
|
|
|
|
|
+ width: '22px',
|
|
|
|
|
+ height: '22px',
|
|
|
|
|
+ background: 'url(https://zos.alipayobjects.com/rmsportal/iSrlOTqrKddqbOmlvUfq.svg) center center / 21px 21px no-repeat'
|
|
|
|
|
+ }}/>
|
|
|
|
|
+)
|
|
|
|
|
+
|
|
|
|
|
+const CartUnselectedIcon = () => (
|
|
|
|
|
+ <div style={{
|
|
|
|
|
+ width: '22px',
|
|
|
|
|
+ height: '22px',
|
|
|
|
|
+ background: 'url(https://gw.alipayobjects.com/zos/rmsportal/BTSsmHkPsQSPTktcXyTV.svg) center center / 21px 21px no-repeat'
|
|
|
|
|
+ }}/>
|
|
|
|
|
+)
|
|
|
|
|
+
|
|
|
|
|
+const CartSelectedIcon = () => (
|
|
|
|
|
+ <div style={{
|
|
|
|
|
+ width: '22px',
|
|
|
|
|
+ height: '22px',
|
|
|
|
|
+ background: 'url(https://gw.alipayobjects.com/zos/rmsportal/ekLecvKBnRazVLXbWOnE.svg) center center / 21px 21px no-repeat'
|
|
|
|
|
+ }}/>
|
|
|
|
|
+)
|
|
|
|
|
+
|
|
|
|
|
+const MyUnselectedIcon = () => (
|
|
|
|
|
+ <div style={{
|
|
|
|
|
+ width: '22px',
|
|
|
|
|
+ height: '22px',
|
|
|
|
|
+ background: 'url(https://zos.alipayobjects.com/rmsportal/psUFoAMjkCcjqtUCNPxB.svg) center center / 21px 21px no-repeat'
|
|
|
|
|
+ }}/>
|
|
|
|
|
+)
|
|
|
|
|
+
|
|
|
|
|
+const MySelectedIcon = () => (
|
|
|
|
|
+ <div style={{
|
|
|
|
|
+ width: '22px',
|
|
|
|
|
+ height: '22px',
|
|
|
|
|
+ background: 'url(https://zos.alipayobjects.com/rmsportal/IIRLrXXrFAhXVdhMWgUI.svg) center center / 21px 21px no-repeat'
|
|
|
|
|
+ }}/>
|
|
|
|
|
+)
|