数据绑定实践:


页面结构

数据

绑定数据

样式

样式

样式

效果图
//weather.wxml
{{temp}} C
{{low}}/{{high}}
{{type}}
{{city}}
{{week}}
{{weather}}
//weather.js
Page({
data:{
temp:4,
low:"-1 C",
high:"10 C",
type:"晴",
week:"星期二",
city:"昆山",
weather:"无持续风行,微风级"
}
}
);
//weather.wxss
.content{
font-family:'微软雅黑 宋体';
font-size:14px;
background-size:cover;
height: 100%;
width: 100%;
color: #333333;
}
.today{
padding-top: 70rpx;
height: 50%;
}
.temp{
font-size: 80px;
text-align: center;
}
.city{
font-size: 20px;
text-align: center;
margin-top: 20rpx;
margin-right: 10rpx;
}
.lowhigh{
font-size: 12px;
text-align: center;
margin-top: 30rpx;
}
.type{
font-size: 16px;
text-align: center;
margin-top: 30rpx;
}
.week{
font-size: 12px;
text-align: center;
margin-top: 30rpx;
}
.weather{
font-size: 12px;
text-align: center;
margin-top: 20rpx;
}