Commit 4e3bb7d594ff32770ad835fe3fc88fede802826a
1 parent
71956d5c
是都显示视频播放按钮判断
Showing
4 changed files
with
41 additions
and
3 deletions
src/components/darenListCom/darenListCom.vue
| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | <!-- 达人图片展示(单独组建处理,宫格形式) --> |
| 30 | 30 | <palace-grid |
| 31 | 31 | :grids="{ |
| 32 | - list:item.img | |
| 32 | + list:imgArr | |
| 33 | 33 | }"> |
| 34 | 34 | </palace-grid> |
| 35 | 35 | </div> |
| ... | ... | @@ -96,7 +96,7 @@ |
| 96 | 96 | name: "darenListCom", |
| 97 | 97 | data() { |
| 98 | 98 | return { |
| 99 | - | |
| 99 | + imgArr: [] | |
| 100 | 100 | } |
| 101 | 101 | }, |
| 102 | 102 | props: ["item"], |
| ... | ... | @@ -191,6 +191,26 @@ |
| 191 | 191 | palaceGrid, |
| 192 | 192 | goodsItem4 |
| 193 | 193 | }, |
| 194 | + mounted() { | |
| 195 | + | |
| 196 | + // 如果有图片数组,处理图片数组 | |
| 197 | + if (this.item.img && this.item.img.length) { | |
| 198 | + | |
| 199 | + // 遍历数组 | |
| 200 | + this.item.img.forEach((item, index) => { | |
| 201 | + this.imgArr.push({ | |
| 202 | + img: item, | |
| 203 | + w: 0, | |
| 204 | + h: 0 | |
| 205 | + }); | |
| 206 | + | |
| 207 | + // 判断如果有视频,添加有视频属性到imgArr中 | |
| 208 | + if (index === 0 && this.item.video && this.item.video_img) { | |
| 209 | + this.$set(this.imgArr[index], "v", true); | |
| 210 | + } | |
| 211 | + }); | |
| 212 | + } | |
| 213 | + }, | |
| 194 | 214 | methods: { |
| 195 | 215 | |
| 196 | 216 | /** | ... | ... |
src/components/palaceGrid/palaceGrid.less
| ... | ... | @@ -26,7 +26,22 @@ |
| 26 | 26 | width: 100%; |
| 27 | 27 | height: 340px; |
| 28 | 28 | } |
| 29 | - | |
| 29 | + .play_box{ | |
| 30 | + width: 100%; | |
| 31 | + height: 100%; | |
| 32 | + position: absolute; | |
| 33 | + left: 0; | |
| 34 | + top:0; | |
| 35 | + //background-color: #000; | |
| 36 | + z-index: 1; | |
| 37 | + display: flex; | |
| 38 | + justify-content: center; | |
| 39 | + align-items: center; | |
| 40 | + img{ | |
| 41 | + width: 86px; | |
| 42 | + height: 86px; | |
| 43 | + } | |
| 44 | + } | |
| 30 | 45 | } |
| 31 | 46 | .two{ |
| 32 | 47 | width: calc(calc(100% / 2)); | ... | ... |
src/components/palaceGrid/palaceGrid.vue
| ... | ... | @@ -11,6 +11,9 @@ |
| 11 | 11 | lazy-load |
| 12 | 12 | :src="item.img || item" |
| 13 | 13 | /> |
| 14 | + <div v-if="index<8&&item.v === true" class="play_box"> | |
| 15 | + <img src="static/img/play.png" /> | |
| 16 | + </div> | |
| 14 | 17 | <div v-if="grids.list.length>9 && index == 8" class="title">共{{grids.list.length}}张</div> |
| 15 | 18 | </div> |
| 16 | 19 | </div> | ... | ... |
static/img/play.png
0 → 100755
2.91 KB