Commit 966e6425 authored by wildfirecode13's avatar wildfirecode13

1

parent fc4f6656
'use strict';
import React, { Component } from 'react';
import resList from '../../resconfig/resList';
//import API from '../../api';
import {Countdown} from 'teddi'
import './pageindex.less';
class Pageindex extends Component {
constructor(props) {
super(props);
this.state = { resList: resList };
}
componentDidMount(){
}
render() {
return <div className="index ">
</div>;
}
}
export default Pageindex;
.index {
top: 0px;
left: 0px;
width: 750px;
height: 1624px;
display: block;
position: absolute;
}
...@@ -10,7 +10,7 @@ import { Countdown } from 'teddi' ...@@ -10,7 +10,7 @@ import { Countdown } from 'teddi'
class Pageindex extends Component { class Pageindex extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { resList: resList ,countdown1:{},countdown2:{}}; this.state = { resList: resList ,countdown1:{},countdown2:{},countdown3:{}};
} }
componentDidMount() { componentDidMount() {
...@@ -25,14 +25,28 @@ class Pageindex extends Component { ...@@ -25,14 +25,28 @@ class Pageindex extends Component {
this.setState({countdown2:data}) this.setState({countdown2:data})
}, this); }, this);
countdown2.start(); countdown2.start();
const countdown3 = new Countdown(0 * 1 + 60 * 0 + 10, 'mmss');
countdown3.on('update', (data) => {
this.setState({countdown3:data})
}, this);
countdown3.on('complete', (data) => {
this.setState({countdown3Complete:1})
}, this);
countdown3.start();
} }
render() { render() {
const {countdown1,countdown2} = this.state; const {countdown1,countdown2,countdown3} = this.state;
return <div className="index "> return <div className="index ">
<h5>倒计时</h5>
<div> {countdown1.dd}:{countdown1.hh}:{countdown1.mm}:{countdown1.ss} </div> <div> {countdown1.dd}:{countdown1.hh}:{countdown1.mm}:{countdown1.ss} </div>
<div> {countdown1.dd}{countdown1.hh}小时{countdown1.mm}分钟{countdown1.ss}</div> <div> {countdown1.dd}{countdown1.hh}小时{countdown1.mm}分钟{countdown1.ss}</div>
<div> {countdown2.hh}小时{countdown2.mm}分钟{countdown2.ss}</div> <div> {countdown2.hh}小时{countdown2.mm}分钟{countdown2.ss}</div>
{
this.state.countdown3Complete ? <div>吃饭时间到</div> : <div>还有{countdown3.mm}分钟{countdown3.ss}秒吃饭</div>
}
</div>; </div>;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment