1.实现小程序天气预报搜索框
<input class='ipt' placeholder-class='pla' placeholder='请输入城市名,快速查询天气信息' bindconfirm="finish" ></input>
wxss
.pla{
font-size: 26rpx;
}
.nav>.img{
width: 40rpx;
height: 40rpx;
position: absolute;
left: 45rpx;
top: 5rpx;
}
2.实现搜索功能
<!-- weather -->
<view class='info'>
<view class='tem'>
{{tem}} <text>℃</text>
wxss:
.info .tem text{
position:absolute;
right:-30rpx;
top:-15rpx;
font-size:30rpx;
}
.info .wea{
color: #666;
}
.info .air_level{
margin: 10rpx;
font-size: 30rpx;
color: #777;
}
3.实现左右滑动:
<view class="section section_gap">
<view class="title">未来六天天气</view>
<scroll-view class="scroll-view_H" scroll-x style="width: 100%">
<view class="scroll-view-item_H bc_pink">
<view>{{weather.data[0].day}}</view>
<view>{{weather.data[0].wea}}</view>
<image src='../../images/{{weather.data[0].wea_img}}.png' style='width:70%;height:80px'></image></view>
<view class="scroll-view-item_H bc_pink">
<view>{{weather.data[1].day}}</view>
<view>{{weather.data[1].wea}}</view>
<image src='../../images/{{weather.data[1].wea_img}}.png' style='width:70%;height:80px'></image></view>
<view class="scroll-view-item_H bc_pink">
<view>{{weather.data[2].day}}</view>
<view>{{weather.data[2].wea}}</view>
<image src='../../images/{{weather.data[2].wea_img}}.png' style='width:70%;height:80px'></image>
</view>
<view class="scroll-view-item_H bc_pink">
<view>{{weather.data[3].day}}</view>
<view>{{weather.data[3].wea}}</view>
<image src='../../images/{{weather.data[3].wea_img}}.png' style='width:70%;height:80px'></image>
</view>
<view class="scroll-view-item_H bc_pink">
<view>{{weather.data[4].day}}</view>
<view>{{weather.data[4].wea}}</view>
<image src='../../images/{{weather.data[4].wea_img}}.png' style='width:70%;height:80px'></image></view>
<view class="scroll-view-item_H bc_pink">
<view>{{weather.data[5].day}}</view>
<view>{{weather.data[5].wea}}</view>
<image src='../../images/{{weather.data[4].wea_img}}.png' style='width:70%;height:80px'></image></view>
</scroll-view>
</view>
最后页面截图:
实训第六天:搜索框布局及功能实现,实现上下滑动
最新推荐文章于 2024-02-23 16:24:34 发布