palaceGrid.vue
2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<template>
<div class="palace-grid-box" v-if="grids && grids.list && grids.list.length">
<div class="box">
<div class="img-box" >
<div :class="['item',grids.list.length==1?'one':(grids.list.length==2 || grids.list.length==4? 'two':'three')]" v-for="(item, index) in grids.list" :key="index" @click="jump(item)">
<!--<div @click.stop="imagePreview(index)" :class="['item',grids.list.length==1?'one':(grids.list.length==2 || grids.list.length==4? 'two':'three')]" v-for="(item, index) in grids.list" :key="index" @click="jump(item)">-->
<van-image
v-if="index < 9"
class="img"
fit="cover"
lazy-load
:src="(item.img || item) + (item.v === true ? '' : SIGN.BIG)"
>
<template v-slot:error>
<img class="img" src="static/img/x.jpg" alt=""/>
</template>
</van-image>
<div v-if="index < 8 && item.v === true" class="play_box">
<img src="static/img/play.png" />
</div>
<div v-if="grids.list.length>9 && index == 8" class="title">共{{grids.list.length}}张</div>
</div>
</div>
</div>
<!--<van-image-preview v-model="show" :swipeDuration="20000" :start-position="index" :show-indicators="true" :images="grids.list" @change="onChange">-->
<!--<template v-slot:index>第{{ index }}页</template>-->
<!--</van-image-preview>-->
</div>
</template>
<script>
export default {
name: "palaceGrid",
data: function () {
return {show: false,
index: 0,
images: [
'https://img.yzcdn.cn/1.jpg',
'https://img.yzcdn.cn/2.jpg'
]
}
},
created(){
},
props: ["grids"],
methods: {
/**
* 点击跳转事件绑定
*/
jump(item) {
this.$emit("jump", item);
},
/**
* 图片预览
*/
imagePreview(index){
this.show = true;
this.index = index;
},
/**
* 点击轮播图变大
*/
onChange(index) {
this.index = index;
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style rel="stylesheet/less" lang="less">
@import './palaceGrid';
</style>