进入weather.wxml,修改weeks数组,添加星期数据,代码如下

    1. Page({
    2. data:{
    3. city:"北京",
    4. area:"海淀",
    5. weather:"多云",
    6. temperature:"18℃",
    7. weeks:[
    8. {week:"周三",temp:{highest:"18℃",lowest:"12℃"}},
    9. {week:"周四",temp:{highest:"16℃",lowest:"10℃"}},
    10. {week:"周五",temp:{highest:"19℃",lowest:"13℃"}}
    11. ]
    12. }
    13. })

    修改weather.wxml文件,使用wx:for渲染星期列表,代码如下

    1. <view class="container">
    2. <image class="bg" mode="widthFix" src="/public/imgs/qntq-bg.png"></image>
    3. <text class="weather">{{weather}}</text>
    4. <text class="city">{{city}}{{area}}</text>
    5. <text class="temperature">{{temperature}}</text>
    6. <view class="week-list">
    7. <view class="week-item" wx:for="{{weeks}}" wx:for-item="w" wx:key="index">
    8. <view class="week">{{w.week}}</view>
    9. <view class="temp">{{w.temp.highest}}~{{w.temp.lowest}}℃</view>
    10. </view>
    11. </view>
    12. </view>

    image.png