This commit is contained in:
zuiidea
2016-12-14 23:11:56 +08:00
parent 67dd886130
commit e9c361a8a9
5 changed files with 245 additions and 51 deletions
+14 -19
View File
@@ -1,26 +1,21 @@
import React, {PropTypes} from 'react'
import {Icon} from 'antd'
import styles from './weather.less'
import {classnames, request} from '../../utils'
const Ajax = require("robe-ajax")
const Weather = React.createClass({
componentDidMount() {
this.fetch()
},
fetch() {
// Ajax.getJSON("http://query.yahooapis.com/v1/public/yql", {
// q: "select * from json where url=\"http://www.zuimeitianqi.com/zuimei/myCity?flg=0\"",
// format: "json"
// }, function (data) {
// console.log(data)
// })
},
render() {
return <div className={styles.weather}>
天气
function Weather(props) {
const {city, icon, dateTime, temperature, name} = props
return <div className={styles.weather}>
<div className={styles.left}>
<div style={styles.icon} style={{
backgroundImage: `url(${icon})`
}}></div>
<p style={styles.name}>{name}</p>
</div>
}
})
<div className={styles.right}>
<h1 className={styles.temperature}>{temperature + '°'}</h1>
<p className={styles.description}>{city},{dateTime}</p>
</div>
</div>
}
export default Weather
+20
View File
@@ -0,0 +1,20 @@
@import "../vars.less";
.weather{
color: #fff;
.left{
.icon{
}
.name{
}
}
.right{
.temperature{
}
.description{
}
}
}