App.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import React, {Component} from 'react';
  2. import {TabBar} from 'antd-mobile';
  3. import {Icon} from 'antd';
  4. import './App.css';
  5. import My from './page/home/My';
  6. import Display from './page/display/Display';
  7. import Manage from "./page/manage/Manage";
  8. class App extends Component {
  9. constructor(props) {
  10. super(props);
  11. this.state = {
  12. selectedTab: 'appointment',
  13. fullScreen: true,
  14. userID: 'handsome'
  15. };
  16. }
  17. render() {
  18. let {userID} = this.state;
  19. return (
  20. <div className="App">
  21. <div style={{position: 'fixed', height: '100%', width: '100%', top: 0}}>
  22. <TabBar
  23. unselectedTintColor="#949494"
  24. tintColor="#328cee"
  25. barTintColor="white"
  26. >
  27. <TabBar.Item
  28. title="预约"
  29. key="appointment"
  30. icon={<Icon type="fire"/>}
  31. selectedIcon={<Icon type="fire" style={{color: '#328cee'}}/>}
  32. selected={this.state.selectedTab === 'appointment'}
  33. onPress={() => {
  34. this.setState({
  35. selectedTab: 'appointment',
  36. });
  37. }}
  38. data-seed="logId"
  39. >
  40. <Display userID={userID}/>
  41. </TabBar.Item>
  42. <TabBar.Item
  43. icon={<Icon type="home"/>}
  44. selectedIcon={<Icon type="home" style={{color: '#328cee'}}/>}
  45. title="我的"
  46. key="my"
  47. selected={this.state.selectedTab === 'my'}
  48. onPress={() => {
  49. this.setState({
  50. selectedTab: 'my',
  51. });
  52. }}
  53. >
  54. <My userID={userID}/>
  55. </TabBar.Item>
  56. <TabBar.Item
  57. icon={<Icon type="setting"/>}
  58. selectedIcon={<Icon type="setting" style={{color: '#328cee'}}/>}
  59. title="管理"
  60. key="manage"
  61. selected={this.state.selectedTab === 'manage'}
  62. onPress={() => {
  63. this.setState({
  64. selectedTab: 'manage',
  65. });
  66. }}
  67. >
  68. <Manage userID={userID}/>
  69. </TabBar.Item>
  70. </TabBar>
  71. </div>
  72. </div>
  73. );
  74. }
  75. }
  76. export default App;