From 8d1419feedee5af04413993b1016967ceadbdc4a Mon Sep 17 00:00:00 2001 From: QinZonger <17611573068@163.com> Date: Thu, 20 Dec 2018 16:46:15 +0800 Subject: [PATCH] page --- src/compents/ch/page.css | 5 ++++ src/compents/ch/page.js | 29 ++++++++++++++++++++ src/compents/ch/page.min.css | 1 + src/compents/ch/page.scss | 4 +++ src/compents/java.js | 48 ++++++++++++++++++++++++--------- src/compents/pages/changdate.js | 11 ++++++++ 6 files changed, 86 insertions(+), 12 deletions(-) create mode 100644 src/compents/ch/page.css create mode 100644 src/compents/ch/page.js create mode 100644 src/compents/ch/page.min.css create mode 100644 src/compents/ch/page.scss create mode 100644 src/compents/pages/changdate.js diff --git a/src/compents/ch/page.css b/src/compents/ch/page.css new file mode 100644 index 0000000..ebc82d9 --- /dev/null +++ b/src/compents/ch/page.css @@ -0,0 +1,5 @@ +@import '~antd/dist/antd.css'; +.page { + width: 100%; + height: 100%; +} diff --git a/src/compents/ch/page.js b/src/compents/ch/page.js new file mode 100644 index 0000000..0187d8a --- /dev/null +++ b/src/compents/ch/page.js @@ -0,0 +1,29 @@ +import React, { Component } from 'react' +import { Card } from 'antd'; +import Highlight from 'react-highlight' +import './page.css' +class Page extends Component { + render() { + const { date } = this.props + console.log(date,'----dd') + return ( +
+ { + date.date.map((item, index)=>{ + return ( +
+ +

1 : npm install dva-cli -g

+

2 : dva new dva-quickstart

+

3 : cd dva-quickstart npm start

+
+
+ ) + }) + } +
+ ) + } +} + +export default Page \ No newline at end of file diff --git a/src/compents/ch/page.min.css b/src/compents/ch/page.min.css new file mode 100644 index 0000000..f923428 --- /dev/null +++ b/src/compents/ch/page.min.css @@ -0,0 +1 @@ +.page{width:100%;height:100%} diff --git a/src/compents/ch/page.scss b/src/compents/ch/page.scss new file mode 100644 index 0000000..7c70e99 --- /dev/null +++ b/src/compents/ch/page.scss @@ -0,0 +1,4 @@ +.page{ + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/src/compents/java.js b/src/compents/java.js index 7d4844c..4223f2e 100644 --- a/src/compents/java.js +++ b/src/compents/java.js @@ -1,14 +1,16 @@ import React, { Component } from 'react'; -import { Menu, Icon } from 'antd'; +import { Menu } from 'antd'; import './java.css' import Dva from './pages/dva' import Reacter from './pages/react' import Js from './pages/js' +import Page from '../compents/ch/page' const SubMenu = Menu.SubMenu; -const MenuItemGroup = Menu.ItemGroup; class Index extends Component { state = { - current: '', + current: 'dva', + alldate : [] , //总数据 + sleDate : {} // 筛选的数据 } handleClick = (e) => { @@ -16,13 +18,29 @@ class Index extends Component { current: e.key, }); } - + Select = () => { // 筛选函数 + let a = {} + this.state.alldate.forEach(( item, index) => { + if(item.name == this.state.current){ + a = item + } + }); + return a + } render() { let Ele = Dva; if (this.state.current === 'react'){ - Ele = Reacter + Ele = Reacter }else if(this.state.current === 'js'){ Ele = Js + }else if(this.state.current === 'dva'){ + Ele = Dva + }else{ + Ele = Page + this.Select() // 触发筛选函数 + } + const pagedate= { + date : this.Select() //筛选函数赋值 } return (
@@ -43,21 +61,27 @@ class Index extends Component { JS 工具}> - Github - VsCode + Github + VsCode - - Navigation Four - Link - -
+
); } + getDate(){ + fetch('https://www.easy-mock.com/mock/5c1b265248952b7bd65143e1/date') + .then( res => res.json() ) + .then( date => { + this.setState({ + alldate : date + }) + } ) + } componentDidMount(){ - + this.getDate() } } diff --git a/src/compents/pages/changdate.js b/src/compents/pages/changdate.js new file mode 100644 index 0000000..c30b531 --- /dev/null +++ b/src/compents/pages/changdate.js @@ -0,0 +1,11 @@ +import React, { Component } from 'react' + +export default class Changdate extends Component { + render() { + return ( +
+ +
+ ) + } +}