123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <template>
- <ul class="con">
- <li class="item" v-for="(item,i) in list" @click="handleClick(item)" :key="i">
- <div class="card-img">
- <img class="full" :src="item.imgstr||require('@/assets/images/myModel.jpg')" alt="" />
- <img class="real" :src="item.imgstr||require('@/assets/images/myModel.jpg')" alt="" />
- </div>
- <div class="card-txt">
- <div class="title">
- <span :title="item.name">{{ item.name||'名字' }}</span>
- </div>
- </div>
- </li>
- <div v-if="list.length<=0" class="no-record">
- 暂无数据
- </div>
- </ul>
- </template>
- <script>
- export default {
- props: ["data"],
- data() {
- return {
- };
- },
- computed:{
- list(){
- return this.data
- }
- },
- methods:{
- handleClick(item){
- this.$showBroadcast({item})
- this.$emit('toggle',false)
- }
- }
- };
- </script>
- <style lang="less" scoped>
- @margin: 36px;
- .item {
- text-align: center;
- display: inline-block;
- width: calc((100% - @margin * 3) / 4);
- margin-right: @margin;
- margin-bottom: @margin;
- background: #FFFFFF;
- border-radius: 8px;
- overflow: hidden;
- cursor: pointer;
- &:nth-of-type(4n) {
- margin-right: 0;
- }
- .card-img {
- position: relative;
- max-height: 190px;
- overflow: hidden;
- background: linear-gradient(180deg, #AAAAAA 0%, #D1D1D1 100%);
- img {
- height: 100%;
- }
- .full {
- opacity: 0;
- }
- .real {
- position: absolute;
- z-index: 99;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- }
- }
- .card-txt {
- display: flex;
- justify-content: space-between;
- align-items: center;
- font-size: 14px;
- padding: 8px 10px;
- color: #333;
- width: 100%;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- .tag {
- color: @theme;
- }
- div{
- overflow: hidden;
- text-overflow:ellipsis;
- white-space: nowrap;
- }
- }
- }
- @media screen and (min-width: 500px) and (max-width: 1400px) {
- .item {
- width: calc((100% - @margin * 2) / 3);
- &:nth-of-type(3n) {
- margin-right: 0;
- }
- &:nth-of-type(4n){
- margin-right: @margin;
- }
- .card-img{
- max-height: 150px;
- }
- }
- }
- </style>
|