forked from didi/cube-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
147 lines (142 loc) · 3.08 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
140
141
142
143
144
145
146
147
<template>
<div id="app">
<header class="cube-bar">
<h1>cube-ui</h1>
</header>
<section class="cube-content" ref="mfct">
<ul class="cube-list">
<li class="cube-item border-bottom-1px" v-for="component in components">
<router-link class="link" :to="component.path">{{component.text}}<i
class="cubeic-arrow"></i>
</router-link>
</li>
</ul>
</section>
<transition name="move">
<router-view class="cube-view"></router-view>
</transition>
</div>
</template>
<script type="text/ecmascript-6">
import BScroll from 'better-scroll'
export default {
data() {
return {
components: [
{
path: '/button',
text: 'Button'
},
{
path: '/checkbox',
text: 'Checkbox'
},
{
path: '/checkbox-group',
text: 'CheckboxGroup'
},
{
path: '/loading',
text: 'Loading'
},
{
path: '/tip',
text: 'Tip'
},
{
path: '/popup',
text: 'Popup'
},
{
path: '/toast',
text: 'Toast'
},
{
path: '/picker',
text: 'Picker'
},
{
path: '/time-picker',
text: 'TimePicker'
},
{
path: '/dialog',
text: 'Dialog'
},
{
path: '/action-sheet',
text: 'ActionSheet'
},
{
path: '/scroll',
text: 'Scroll'
},
{
path: '/slide',
text: 'Slide'
},
{
path: '/index-list',
text: 'IndexList'
}
]
}
},
mounted() {
this.$nextTick(() => {
/* eslint-disable no-new */
new BScroll(this.$refs.mfct, {
click: true
})
})
}
}
</script>
<style lang="stylus" rel="stylesheet/stylus">
body
background-color: #fff
.cube-bar
position: fixed
z-index: 10
right: 0
left: 0
height: 44px
line-height: 44px
text-align: center
background-color: #f7f7f7
box-shadow: 0 1px 6px #ccc
-webkit-backface-visibility: hidden
backface-visibility: hidden
h1
font-size: 18px
font-weight: 500
.cube-content
position: fixed
width: 100%
top: 44px
left: 0
bottom: 0
overflow: scroll
.cube-list
padding-left: 10px
.cube-item
height: 40px
line-height: 40px
.link
display: block
position: relative
width: 100%
color: #333
text-decoration: none
outline: 0
.cubeic-arrow
position: absolute
right: 0
padding: 0 5px
color: #ccc
.cube-view
transition: all 0.3s
transform: translate3d(0, 0, 0)
&.move-enter-active, &.move-leave-active
transform: translate3d(100%, 0, 0)
</style>