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'
class Pageindex extends Component {
constructor(props) {
super(props);
this.state = { resList: resList ,countdown1:{},countdown2:{}};
this.state = { resList: resList ,countdown1:{},countdown2:{},countdown3:{}};
}
componentDidMount() {
......@@ -25,14 +25,28 @@ class Pageindex extends Component {
this.setState({countdown2:data})
}, this);
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() {
const {countdown1,countdown2} = this.state;
const {countdown1,countdown2,countdown3} = this.state;
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> {countdown2.hh}小时{countdown2.mm}分钟{countdown2.ss}</div>
{
this.state.countdown3Complete ? <div>吃饭时间到</div> : <div>还有{countdown3.mm}分钟{countdown3.ss}秒吃饭</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