PlayNav.vue
1.8 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
<template>
<view class="play_list">
<view v-for="(item, index) in navList" :key="index" :class="{active: index === current}" class="play_item" @click="toggle(item.id,index)">
<text>{{ item.title }}</text>
<image class="bg_nav" :src="item.bgImg" mode="widthFix"></image>
</view>
</view>
</template>
<script>
import bg1 from '@/static/homeImg/bg_1.png'
import bg2 from '@/static/homeImg/bg_2.png'
import bg3 from '@/static/homeImg/bg_3.png'
export default {
data() {
return {
current: 0,
navList: [
{ id: 1, title: '狼人杀', bgImg: bg1},
{ id: 2, title: '剧本杀', bgImg: bg2},
{ id: 3, title: '密室逃脱', bgImg: bg3}
]
}
},
methods: {
toggle(id, index){
this.current = index
this.$emit('playName', id)
}
}
}
</script>
<style lang="scss" scoped>
.play_list{
display: flex;
align-items: flex-end;
justify-content: space-between;
min-height: 100rpx;
margin: 20rpx 0;
.play_item{
position: relative;
width: 200rpx;
height: 80rpx;
text-align: center;
line-height: 80rpx;
color: #fff;
font-size: 28rpx;
background: linear-gradient( 45deg, #966CFF 0%, #C3ACFF 59%);
border-radius: 12rpx;
transition: all .3s ease;
&:nth-child(2){
.bg_nav{
width: 96rpx;
right: -11%;
}
}
&:nth-child(3){
.bg_nav{
width: 78rpx;
right: -8%;
}
}
.bg_nav{
position: absolute;
top: 0;
right: -20%;
width: 135rpx;
}
&.active{
width: 250rpx;
height: 100rpx;
line-height: 100rpx;
font-weight: 500;
font-size: 36rpx;
.bg_nav{
transform: scale(1.5);
top: 20rpx;
right: -32rpx;
}
}
&:nth-child(2) {
background: linear-gradient( 45deg, #FF9B8A 0%, #FFCBC2 68%);
}
&:nth-child(3) {
background: linear-gradient( 45deg, #75ACFF 0%, #A0C6FF 57%);
}
}
}
</style>