Browse Source

开始 my

kulley 6 years ago
parent
commit
019fba8d3a

+ 0 - 1
src/pages/cart/CartItem.jsx

@@ -22,7 +22,6 @@ export class CartItem extends Component {
         this.setState({
             arr
         })
-
     }
 
     //获取输入框的值

+ 0 - 0
src/pages/my/all/index.css


+ 19 - 0
src/pages/my/all/index.js

@@ -0,0 +1,19 @@
+import React, {Component} from 'react'
+import './index.css'
+
+class All extends Component {
+    constructor(props) {
+        super(props)
+        this.state = {
+
+        }
+    }
+
+    render() {
+        return (
+            <div>all</div>
+        )
+    }
+}
+
+export default All

+ 0 - 0
src/pages/my/index.css


+ 33 - 2
src/pages/my/index.js

@@ -1,17 +1,48 @@
 import React, {Component} from 'react'
+import './index.css'
+import All from './all'
+import Order from './order'
+
 class My extends Component {
     constructor(props) {
         super(props)
         this.state = {
+            page: 'all',
+            param: {}
+        }
+    }
 
+    changePageInHome = (page, param, hidden) => {
+        this.props.changeTabBar('my', hidden !== undefined ? hidden : true)
+        this.setState({
+            page,
+            param: param ? param : {}
+        })
+    }
+
+    renderPage = () => {
+        let {page, param} = this.state
+
+        switch (page) {
+            case 'all':
+                return <All changePageInHome={this.changePageInHome} {...param}/>
+            case 'order':
+                return <Order changePageInHome={this.changePageInHome} {...param}/>
+            default:
+                return <div>这个页面不应该出现是</div>
         }
     }
 
     render() {
         return (
-            <div>My</div>
+            <div style={{height: '100%'}}>
+                {
+                    this.renderPage()
+                }
+            </div>
         )
     }
 }
 
-export default My
+export default My
+

+ 0 - 0
src/pages/my/order/index.css


+ 20 - 0
src/pages/my/order/index.js

@@ -0,0 +1,20 @@
+import React, {Component} from 'react'
+import './index.css'
+import All from "../all"
+
+class Order extends Component {
+    constructor(props) {
+        super(props)
+        this.state = {
+
+        }
+    }
+
+    render() {
+        return (
+            <div>order</div>
+        )
+    }
+}
+
+export default Order