You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

269 lines
6.0 KiB

<template>
<view class="home">
<view class="home-list">
<view v-for="(item,index) in tableList" :key="item._id" :item="item">
<view @click="open">
<!-- 基础卡片 -->
<view v-if="item.mode==='base'" class="listcard">
<view class="listcard-image">
<image :src="item.cover[0]" mode="aspectFill"></image>
</view>
<view class="listcard-content">
<view class="listcard-content_title">
<text>{{item.title}}</text>
<likes :types="types" :item="item"></likes>
</view>
<view class="listcard-content_des">
<view class="listcard-content_des-label">
<view class="listcard-content_des-label-item">{{item.classify}}</view>
</view>
<view class="listcard-content_des-browe">{{item.browse_count}}浏览</view>
</view>
</view>
</view>
<!-- 多图模式 -->
<view v-if="item.mode==='column'" class="listcard mode-column">
<view class="listcard-content">
<view class="listcard-content_title">
<text>{{item.title}}</text>
<likes :types="types" :item="item"></likes>
</view>
<view class="listcard-image">
<view v-if="index<3" v-for="(item,index) in item.cover" :key="index"
class="listcard-image_item">
<image :src="item" mode="aspectFill"></image>
</view>
</view>
<view class="listcard-content_des">
<view class="listcard-content_des-label">
<view class="listcard-content_des-label-item">{{item.classify}}</view>
</view>
<view class="listcard-content_des-browe">{{item.browse_count}}浏览</view>
</view>
</view>
</view>
<!-- 大图模式 -->
<view v-if="item.mode==='image'" class="listcard mode-image">
<view class="listcard-image">
<image :src="item.cover[0]" mode="aspectFill"></image>
</view>
<view class="listcard-content">
<view class="listcard-content_title">
<text>{{item.title}}</text>
<likes :types="types" :item="item"></likes>
</view>
<view class="listcard-content_des">
<view class="listcard-content_des-label">
<view class="listcard-content_des-label-item">{{item.classify}}</view>
</view>
<view class="listcard-content_des-browe">{{item.browse_count}}浏览</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
types:"",
tableList: [{
_id: 1,
title: "到速度奥昂是大宋到速度奥昂是大宋到速度奥昂是大宋",
mode: 'base',
cover: [
"https://ts1.cn.mm.bing.net/th/id/R-C.df4462fabf18edd07195679a5f8a37e5?rik=FnNvr9jWWjHCVQ&riu=http%3a%2f%2fseopic.699pic.com%2fphoto%2f50059%2f8720.jpg_wh1200.jpg&ehk=ofb4q76uCls2S07aIlc8%2bab3H5zwrmj%2bhqiZ%2fyw3Ghw%3d&risl=&pid=ImgRaw&r=0"
],
classify: 111,
browse_count: 111
},
{
_id: 2,
title: "啊实打实大苏打实打实打算大苏打",
mode: 'column',
cover: [
"https://pic3.zhimg.com/v2-58d652598269710fa67ec8d1c88d8f03_r.jpg?source=1940ef5c",
"https://pic3.zhimg.com/v2-58d652598269710fa67ec8d1c88d8f03_r.jpg?source=1940ef5c",
"https://pic3.zhimg.com/v2-c6ae9c3aff36b9b221258f6a90577902_r.jpg",
"https://pic3.zhimg.com/v2-c6ae9c3aff36b9b221258f6a90577902_r.jpg"
],
classify: 222,
browse_count: 222
},
{
_id: 3,
title: "都是否定的撒撒大撒反对的飒飒的撒范德萨",
mode: 'image',
cover: [
"https://ts1.cn.mm.bing.net/th?id=OIP-C.kJE5c2uL7he1BwdQb3-APAHaNK&w=187&h=333&c=8&rs=1&qlt=90&o=6&pid=3.1&rm=2"
],
classify: 333,
browse_count: 333
},
],
};
},
methods: {
open() {
}
}
};
</script>
<style lang="scss">
page {
height: 100%;
display: flex;
}
.home {
display: flex;
flex-direction: column;
flex: 1;
overflow: hidden;
.home-list {
flex: 1;
box-sizing: border-box;
}
}
.listcard {
display: flex;
padding: 15px;
margin: 20px;
border-radius: 5px;
box-shadow: 0 0 5px 1px rgba($color:#000000, $alpha:0.1);
box-sizing: border-box;
.listcard-image {
flex-shrink: 0;
width: 80px;
height: 80px;
border-radius: 8px;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.listcard-content {
display: flex;
flex-direction: column;
padding-left: 10px;
width: 100%;
justify-content: space-between;
.listcard-content_title {
padding-right: 30px;
font-size: 14px;
color: #333;
font-weight: 400;
line-height: 1.2;
position: relative;
text {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
.listcard-content_des {
display: flex;
justify-content: space-between;
font-size: 12px;
.listcard-content_des-label {
display: flex;
.listcard-content_des-label-item {
padding: 0 5px;
margin-right: 5px;
border-radius: 15px;
color: #f00;
border: 1px #f00 solid;
}
}
.listcard-content_des-browe {
color: #999;
line-height: 1.5;
}
}
}
&.mode-column {
.list-content {
width: 100%;
padding-left: 0;
}
.listcard-image {
display: flex;
margin-top: 10px;
width: 100%;
height: 80px;
.listcard-image_item {
margin-left: 10px;
width: 100%;
border-radius: 5px;
overflow: hidden;
&:first-child {
margin-left: 0;
}
image {
width: 100%;
height: 100%;
}
}
}
.listcard-content_des {
margin-top: 10px;
}
}
&.mode-image {
flex-direction: column;
.listcard-image {
width: 100%;
height: 100px;
}
.listcard-content {
padding-left: 0;
margin-top: 10px;
.listcard-content_des {
display: flex;
align-items: center;
margin-top: 10px;
}
}
}
}
</style>