一、【首页】推荐部分开发
1.1 完成效果图:
1.2 在components中新建组件Recommend.vue,代码如下:
<template>
<view class='recommend bg-color'>
<view class='recommend-item'>
<image class='item-big' src='../../static/image/Children.jpg' mode=""></image>
<view class='item-small'>
<image class='item-img' src="../../static/image/Children1.jpg" mode=""></image>
<image class='item-img' src="../../static/image/Children2.jpg" mode=""></image>
<image class='item-img' src="../../static/image/Children3.jpg" mode=""></image>
</view>
<view class='recommend-item'>
<image class='item-big' src='../../static/image/Furnishing.jpg' mode=""></image>
<view class='item-small'>
<image class='item-img' src="../../static/image/Furnishing1.jpg" mode=""></image>
<image class='item-img' src="../../static/image/Furnishing2.jpg" mode=""></image>
<image class='item-img' src="../../static/image/Furnishing3.jpg" mode=""></image>
</view>
</view>
</view>
</view>
</template>
<script>
</script>
<style scoped>
.recommend{
padding: 20rpx;
}
.recommend-item{
display: flex;
flex-direction: column;
border-radius: 20rpx;
border: 2rpx solid #55ffff;
overflow: hidden;
margin: 20rpx 0;
}
.item-big{
width: 100%;
height: 300rpx;
}
.item-small{
width: 100%;
height: 240rpx;
}
.item-img{
width: 33.33333%;
height: 240rpx;
}
</style>
1.3 在pages/index/index.vue中引入Recommend组件。
1.3.1 import Recommend from'@/components/index/Recommend.vue'
1.3.2 components:{
IndexSwiper,
Recommend
}
1.3.3 在template部分中使用
标签:index,1.3,推荐,20rpx,item,开发,首页,Recommend,width From: https://www.cnblogs.com/liu88/p/17038333.html