-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathApp.vue
139 lines (136 loc) · 3.17 KB
/
App.vue
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
133
134
135
136
137
138
139
<template>
<div id="app">
<div class="header">
<h1 class="title" @click="showPicker">
<span>全部赛事</span>
<i class="cubeic-select" :class="{down: toDown}"></i>
</h1>
<div class="navigator">
<ul class="nav-list">
<li v-for="(item, index) in tabList" :key="index"
@click="switchTab(index)" :class="{active: currentPage === index}">
{{ item }}
</li>
</ul>
<div class="triangle-up" :class="{left: currentPage === 0, right: currentPage === 2}"></div>
</div>
</div>
<div class="content">
<cube-slide
:data="tabList"
:initialIndex="currentPage"
:loop="false"
:autoPlay="false"
:threshold="0.1"
@change="slideChange">
<cube-slide-item v-for="(item, index) in tabList" :key="index">
<div class="match-list-wrapper">
<match-list :type="type" :status="index"></match-list>
</div>
</cube-slide-item>
<div slot="dots"></div>
</cube-slide>
</div>
</div>
</template>
<script>
import MatchList from './components/match-list'
export default {
name: 'app',
data () {
return {
currentPage: 1,
tabList: ['已结束', '直播中', '我的关注'],
toDown: false,
pickerList: [
{text: 'NBA', value: 'NBA'},
{text: 'DOTA', value: 'dota'},
{text: 'SOCCER', value: 'soccer'}
],
type: 'soccer'
}
},
mounted () {
this.picker = this.$createPicker({
title: '赛事',
data: [this.pickerList],
onSelect: () => {
this.toDown = false
},
onCancel: () => {
this.toDown = false
},
onValueChange: (selectedVal) => {
this.type = selectedVal[0]
}
})
},
methods: {
switchTab (index) {
this.currentPage = index
},
slideChange (index) {
this.currentPage = index
},
showPicker () {
this.toDown = true
this.picker.show()
}
},
components: {
MatchList
}
}
</script>
<style lang="stylus">
@import './common/stylus/mixin.styl'
html, body, #app
height: 100%
text-align: center
#app
background-color: color_grey
.header
color: white
background-color: #15191D
.title
padding: 20px 0
font-size: 16px
color: white
display: inline-block
.down
display: inline-block
transform: rotate(180deg)
.navigator
position: relative
padding-bottom: 12px
font-size: 12px
.nav-list
display: flex
justify-content: space-around
li
width: 60px
color: #E0E4E8
&.active
color: white
.triangle-up
position: absolute
left: 50%
transform: translate(-50%, 0)
bottom: 0
width: 0
height: 0
border-left: 7px solid transparent
border-right: 7px solid transparent
border-bottom: 8px solid color_grey
transition: all 0.4s
&.left
left: 16.67%
&.right
left: 83.34%
.content
height: calc(100% - 80px)
overflow: hidden
.match-list-wrapper
height: 100%
background-color: #E2E5EA
</style>