<template> <div class="main"> <div v-for="item in list" :key="item" class="row"> <div v-for="child in item" :key="child" class="list-item"> <div class="img-wrap"> <img src="../../assets/404_images/404.png" style="width: 100%; height: 100%" > </div> <div class="title text-over"> 摄像头摄像头摄像头摄像头摄像头摄像头摄像头摄像头00{{ child }} </div> <div class="desc text-over"> 这是详情描述这是详情描述这是详情描述这是详情描述这是详情描述 </div> <div class="date"> 2023-1-1 12:00:32 </div> <div class="ratio"> 50% </div> </div> </div> </div> </template> <script> export default { name: "ListItem", // props: {}, data() { return {} }, methods: {} } </script> <style rel="stylesheet/scss" lang="scss" scoped> .main{ width:99%; margin: 0 auto; display: flex; flex-direction: column; .row { display: flex; justify-content: space-between; margin-bottom: 40px; } .row:nth-child(2n) { flex-direction: row-reverse; } .row:nth-child(2n):last-child .item { margin-right: auto; } .list-item{ position: relative; width: 48%; height: 240px; background-image: url("../../assets/global_images/monitor.png"); background-repeat: no-repeat; // background-size: cover; background-size: 100% 100%; margin-left: 20px; .img-wrap{ position: absolute; left:35px; top:40px; width:236px; height:138px; overflow: hidden; } .title{ width:200px; position: absolute; left:42%; top: 40px; font-size: 20px; color:#40C3F1; } .desc{ width:300px; position: absolute; left:42%; top: 75px; font-size: 16px; color:#f1f1f1; } .date{ position: absolute; left:50%; transform: translateX(-50%); bottom:70px; font-size: 14px; color:#c1c1c1; margin-left:25px; } .date::after{ position: absolute; top:0; left:-20px; content:""; display: inline-block; width: 15px; height: 15px; background-image: url("../../assets/global_images/date.png"); background-repeat: no-repeat; background-size: cover; } .ratio{ width:100px; position: absolute; left:50%; transform: translateX(-50%); bottom:40px; font-size: 14px; color:#c1c1c1; margin-left:18px; } .ratio::after{ position: absolute; top:0; left:-20px; content:""; display: inline-block; width: 15px; height: 15px; background-image: url("../../assets/global_images/search.png"); background-repeat: no-repeat; background-size: cover; } } } .main .row:nth-child(odd){ .list-item:nth-child(odd)::after{ content:""; display: inline-block; width:30px; height: 30px; position: absolute; top:50%; transform: translate(-50%); right:-52px; background-image: url("../../assets/global_images/right.png"); background-repeat: no-repeat; background-size: cover; } } .main .row:nth-child(odd){ .list-item:nth-child(even)::after{ content:""; display: inline-block; width:30px; height: 30px; position: absolute; right:50%; transform: translate(-50%); bottom:-35px; background-image: url("../../assets/global_images/right.png"); background-repeat: no-repeat; background-size: cover; transform: rotate(90deg); } } .main .row:nth-child(even){ .list-item:nth-child(odd)::after{ content:""; display: inline-block; width:30px; height: 30px; position: absolute; top:50%; transform: translate(-50%); left:-35px; background-image: url("../../assets/global_images/right.png"); background-repeat: no-repeat; background-size: cover; transform: rotate(180deg); } } .main .row:nth-child(even){ .list-item:nth-child(even)::after{ content:""; display: inline-block; width:30px; height: 30px; position: absolute; left:50%; transform: translate(-50%); bottom:-35px; background-image: url("../../assets/global_images/right.png"); background-repeat: no-repeat; background-size: cover; transform: rotate(-270deg); } } // 如果是最后一个元素不显示箭头 .main .row:last-child{ .list-item:last-child::after{ display: none; } } </style>