赞
踩
项目名称:本地生活
模板选择:不使用模板
单击【确定】按钮
app.json
里配置pages/grid/grid
页面,删除其它页面images
目录,拷贝项目所需图片素材<!--pages/grid/grid.wxml--> <!-- 轮播图区域 --> <swiper indicator-dots="true" indicator-color="blue" indicator-active-color="red" autoplay="true" circular="true" interval="3000"> <swiper-item> <view class="item"> <image src="/images/swiper01.jpg" mode="aspectFill" style="width: 100%; height: 100%;"/> </view> </swiper-item> <swiper-item> <view class="item"> <image src="/images/swiper02.jpg" mode="aspectFill" style="width: 100%; height: 100%;"/> </view> </swiper-item> <swiper-item> <view class="item"> <image src="/images/swiper03.jpg" mode="aspectFill" style="width: 100%; height: 100%;"/> </view> </swiper-item> </swiper>
<!-- 九宫格区域 --> <view class="grids"> <view class="grid-item"> <image src="/images/food.png"/> <text>美食</text> </view> <view class="grid-item"> <image src="/images/fitup.png"/> <text>装修</text> </view> <view class="grid-item"> <image src="/images/bath.png"/> <text>洗浴</text> </view> <view class="grid-item"> <image src="/images/car.png"/> <text>汽车</text> </view> <view class="grid-item"> <image src="/images/sing.png"/> <text>唱歌</text> </view> <view class="grid-item"> <image src="/images/house.png"/> <text>住宿</text> </view> <view class="grid-item"> <image src="/images/study.png"/> <text>学习</text> </view> <view class="grid-item"> <image src="/images/work.png"/> <text>工作</text> </view> <view class="grid-item"> <image src="/images/marry.png"/> <text>结婚</text> </view> </view>
350rpx
,设置图片容器的高度和宽度。.grids {
height: 350rpx;
}
.item {
width: 100%;
height: 100%;
}
.grids {
display: flex;
flex-wrap: wrap; /* 自动绕行 */
}
.grids .grid-item { width: 250rpx;/* 750 ÷ 3 =250 */ height: 250rpx; border-right: 1rpx solid #eee; border-bottom: 1rpx solid #eee; display: flex; flex-direction: column; justify-content: center; align-items: center; } /* 清除第3个格子的右边框 */ .grids .grid-item:nth-child(3) { border-right: 0; } /* 清除第6个格子的右边框 */ .grids .grid-item:nth-child(6) { border-right: 0; } /* 清除第9个格子的右边框 */ .grids .grid-item:nth-child(9) { border-right: 0; }
/*每个格子内的图片样式*/
.grids .grid-item image {
width: 90rpx;
height: 90rpx;
}
/*每个格子内的文本样式*/
.grids .grid-item text {
color: #999;
font-size: 35rpx;
margin-top: 20rpx;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。