strategy.vue
3.1 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<template>
<LayoutApp title="咸鱼潮玩转攻略" :show-back="true" :back-action="goBack">
<ul>
<li v-for="(item, index) in imageList" :key="index">
<div v-if="item.urls && item.urls.length > 0" class="link-container">
<a href="javascript:;"
:style="{left: linkItem.left, top: linkItem.top, width: linkItem.width, height: linkItem.height}"
v-for="linkItem in item.urls"
:key="linkItem.link"
@click="jumpTo"
:data-item="JSON.stringify(linkItem)"
>
</a>
</div>
<img :src="item.image" alt=""/>
</li>
</ul>
</LayoutApp>
</template>
<script>
export default {
name: 'Strategy',
data() {
return {
imageList: [
{ image: '//cdn.yoho.cn/xianyu/gonglue/1.jpg?imageView2/2/w/750/format/jpg' },
{ image: '//cdn.yoho.cn/xianyu/gonglue/2.jpg?imageView2/2/w/750/format/jpg' },
{ image: '//cdn.yoho.cn/xianyu/gonglue/3.jpg?imageView2/2/w/750/format/jpg' },
{ image: '//cdn.yoho.cn/xianyu/gonglue/4.jpg?imageView2/2/w/750/format/jpg',
urls: [
{
left: '1.25rem',
top: '4.5rem',
width: '7.75rem',
height: '5.25rem',
linkName: 'ChannelPage',
subName: ''
}
]
},
{ image: '//cdn.yoho.cn/xianyu/gonglue/5.jpg?imageView2/2/w/750/format/jpg',
urls: [
{
linkName: 'strategySub',
subName: 'qualityStandard',
left: '1rem',
top: '14rem',
width: '17rem',
height: '2.85rem'
},
{
linkName: 'strategySub',
subName: 'buyerPolicy',
left: '2.5rem',
top: '19rem',
width: '6rem',
height: '3rem'
},
{
linkName: 'strategySub',
subName: 'sellerPolicy',
left: '10.8rem',
top: '19rem',
width: '6rem',
height: '3rem'
}
]
}
]
}
},
methods: {
goBack() {
this.$router.go(-1);
},
jumpTo(event) {
let linkItem = JSON.parse(event.currentTarget.dataset.item || '{}') || {};
if (linkItem.subName === '') {
this.$router.push({
name: linkItem.linkName
});
} else {
this.$router.push({
name: linkItem.linkName,
params: {
subName: linkItem.subName,
},
});
}
}
}
};
</script>
<style lang="scss" scoped>
ul {
width: 100%;
list-style: none;
margin: 0;
padding: 0;
li {
position: relative;
width: 100%;
overflow: hidden;
img {
width: 100%;
float: left;
}
.link-container {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
z-index: 9;
a {
position: absolute;
display: block;
width: 200px;
height: 100px;
background-color: transparent;
}
}
}
}
</style>