10
10
<span class =" message" :key =" message" >{{ message }}</span >
11
11
</transition >
12
12
</span >
13
- <a
14
- class =" button components"
15
- :class =" { active: tab === 'components'}"
16
- v-tooltip =" $t('App.components.tooltip')"
17
- @click =" switchTab('components')"
18
- >
19
- <VueIcon icon =" device_hub" />
20
- <span class =" pane-name" >Components</span >
21
- </a >
22
- <a
23
- class =" button vuex"
24
- :class =" { active: tab === 'vuex'}"
25
- v-tooltip =" $t('App.vuex.tooltip')"
26
- @click =" switchTab('vuex')"
27
- >
28
- <VueIcon icon =" restore" />
29
- <span class =" pane-name" >Vuex</span >
30
- </a >
31
- <a
32
- class =" button events"
33
- :class =" { active: tab === 'events' }"
34
- v-tooltip =" $t('App.events.tooltip')"
35
- @click =" switchTab('events')"
36
- >
37
- <VueIcon icon =" grain" />
38
- <span class =" pane-name" >Events</span >
39
- <span class =" event-count" v-if =" newEventCount > 0" >{{ newEventCount }}</span >
40
- </a >
41
- <a
42
- class =" button refresh"
43
- v-tooltip =" $t('App.refresh.tooltip')"
44
- @click =" refresh"
45
- >
46
- <VueIcon ref =" refresh" icon =" refresh" />
47
- <span class =" pane-name" >Refresh</span >
48
- </a >
49
- <span class =" active-bar" ></span >
13
+
14
+ <div class =" actions" >
15
+ <VueGroup
16
+ v-model =" routeModel"
17
+ class =" primary inline"
18
+ indicator
19
+ >
20
+ <VueGroupButton
21
+ :class =" {
22
+ 'icon-button': !$responsive.wide
23
+ }"
24
+ value =" components"
25
+ icon-left =" device_hub"
26
+ class =" flat"
27
+ v-tooltip =" $t('App.components.tooltip')"
28
+ >
29
+ Components
30
+ </VueGroupButton >
31
+ <VueGroupButton
32
+ :class =" {
33
+ 'icon-button': !$responsive.wide
34
+ }"
35
+ value =" vuex"
36
+ icon-left =" restore"
37
+ class =" flat"
38
+ v-tooltip =" $t('App.vuex.tooltip')"
39
+ >
40
+ Vuex
41
+ </VueGroupButton >
42
+ <VueGroupButton
43
+ :class =" {
44
+ 'icon-button': !$responsive.wide
45
+ }"
46
+ value =" events"
47
+ icon-left =" grain"
48
+ class =" flat"
49
+ v-tooltip =" $t('App.events.tooltip')"
50
+ >
51
+ Events
52
+ </VueGroupButton >
53
+ </VueGroup >
54
+
55
+ <VueButton
56
+ ref =" refresh"
57
+ :class =" {
58
+ 'icon-button': !$responsive.wide
59
+ }"
60
+ icon-left =" refresh"
61
+ v-tooltip =" $t('App.refresh.tooltip')"
62
+ class =" flat"
63
+ @click =" refresh"
64
+ >
65
+ Refresh
66
+ </VueButton >
67
+ </div >
50
68
</div >
51
- <component :is =" tab" class =" container" ></component >
69
+
70
+ <router-view class =" container" />
52
71
</div >
53
72
</template >
54
73
@@ -63,6 +82,7 @@ import { mapState } from 'vuex'
63
82
64
83
export default {
65
84
name: ' app' ,
85
+
66
86
mixins: [
67
87
Keyboard ({
68
88
onKeyDown ({ key, code, modifiers }) {
@@ -75,81 +95,81 @@ export default {
75
95
break
76
96
case ' ctrl' :
77
97
if (code === ' Digit1' ) {
78
- this .switchTab ( ' components' )
98
+ this .$router . push ({ name : ' components' } )
79
99
return false
80
100
} else if (code === ' Digit2' ) {
81
- this .switchTab ( ' vuex' )
101
+ this .$router . push ({ name : ' vuex' } )
82
102
return false
83
103
} else if (code === ' Digit3' ) {
84
- this .switchTab ( ' events' )
104
+ this .$router . push ({ name : ' events' } )
85
105
return false
86
106
}
87
107
}
88
108
}
89
109
})
90
110
],
111
+
91
112
components: {
92
113
components: ComponentsTab,
93
114
vuex: VuexTab,
94
115
events: EventsTab
95
116
},
117
+
96
118
computed: {
97
119
... mapState ({
98
120
message : state => state .message ,
99
- tab : state => state .tab ,
100
121
newEventCount : state => state .events .newEventCount ,
101
122
view : state => state .view
102
123
}),
124
+
103
125
specialTokens () {
104
126
return SPECIAL_TOKENS
127
+ },
128
+
129
+ routeModel: {
130
+ get () { return this .$route .name },
131
+ set (value) {
132
+ this .$router .push ({ name: value })
133
+ }
105
134
}
106
135
},
107
- methods: {
108
- switchTab (tab ) {
136
+
137
+ watch: {
138
+ ' $route.name' (tab) {
109
139
bridge .send (' switch-tab' , tab)
110
- this .$store .commit (' SWITCH_TAB' , tab)
111
140
if (tab === ' events' ) {
112
141
this .$store .commit (' events/RESET_NEW_EVENT_COUNT' )
113
142
}
114
- },
143
+ }
144
+ },
145
+
146
+ methods: {
115
147
refresh () {
116
- const refreshIcon = this .$refs .refresh .$el
148
+ const refreshIcon = this .$refs .refresh .$el . querySelector ( ' .vue-ui-icon ' )
117
149
refreshIcon .style .animation = ' none'
118
150
119
151
bridge .send (' refresh' )
120
152
bridge .once (' flush' , () => {
121
153
refreshIcon .style .animation = ' rotate 1s'
122
154
})
123
155
},
156
+
124
157
switchView (mediaQueryEvent ) {
125
158
this .$store .commit (
126
159
' SWITCH_VIEW' ,
127
160
mediaQueryEvent .matches ? ' vertical' : ' horizontal'
128
161
)
129
- },
130
- updateActiveBar () {
131
- const activeButton = this .$el .querySelector (' .button.active' )
132
- const activeBar = this .$el .querySelector (' .active-bar' )
133
- activeBar .style .left = activeButton .offsetLeft + ' px'
134
- activeBar .style .width = activeButton .offsetWidth + ' px'
135
162
}
136
163
},
164
+
137
165
mounted () {
138
166
this .mediaQuery = window .matchMedia (' (min-width: 685px)' )
139
167
this .switchView (this .mediaQuery )
140
168
this .mediaQuery .addListener (this .switchView )
141
-
142
- this .updateActiveBar ()
143
- window .addEventListener (' resize' , this .updateActiveBar )
144
169
},
170
+
145
171
destroyed () {
146
- window .removeEventListener (' resize' , this .updateActiveBar )
147
172
this .mediaQuery .removeListener (this .switchView )
148
- },
149
- watch: {
150
- tab () {
151
- this .$nextTick (this .updateActiveBar )
152
- }
153
173
}
154
174
}
155
175
</script >
@@ -167,7 +187,7 @@ export default {
167
187
background-color $background-color
168
188
display flex
169
189
flex-direction column
170
- .dark &
190
+ .vue-ui- dark-mode &
171
191
background-color $dark-background-color
172
192
173
193
.header
@@ -177,7 +197,7 @@ export default {
177
197
box-shadow 0 0 8px rgba (0 , 0 , 0 , 0.15 )
178
198
font-size 14px
179
199
position relative
180
- .dark &
200
+ .vue-ui- dark-mode &
181
201
border-bottom 1px solid $dark-border-color
182
202
183
203
.logo
@@ -192,62 +212,32 @@ export default {
192
212
@media (min-width : $wide - 300px )
193
213
display block
194
214
195
-
196
215
.message
197
216
color $active-color
198
217
transition all .3s ease
199
218
position absolute
200
219
201
- .button
202
- padding 10 px
220
+ .actions
221
+ flex auto 1 1
203
222
display flex
204
- align-items center
205
- cursor pointer
206
- position relative
207
- border-bottom-color transparent
208
- background-color $background-color
209
- color #8 8 8
210
- transition color .35s ease
211
- .dark &
212
- background-color $dark-background-color
213
-
214
- .vue-ui-icon
215
- width 20px
216
- height @width
217
- margin-right 5px
218
- >>> svg
219
- fill @color
220
- transition fill .35s ease
221
-
222
- & :hover
223
- color #5 5 5
224
- .vue-ui-icon >>> svg
225
- fill @color
226
-
227
- & .active
228
- color $active-color
229
- .vue-ui-icon >>> svg
230
- fill @color
231
-
232
- & :first-of-type
233
- margin-left auto
234
-
235
- .pane-name
236
- display none
237
-
238
- @media (min-width : $wide)
239
- padding-right 20px
240
- padding-left 20px
241
- .pane-name
242
- display block
223
+ justify-content flex-end
243
224
225
+ .vue-ui-button
226
+ height 38px
227
+ @media (max-width : $wide)
228
+ width 38px
229
+ /deep/
230
+ .button-icon.left
231
+ margin-right 0 !important
232
+ .default-slot
233
+ display none
244
234
@media (min-height : $tall)
245
- padding-top 20px
246
- padding-bottom 20px
235
+ height 48px
236
+ @media (max-width : $wide)
237
+ width @height
247
238
248
- .container
249
- overflow hidden
250
- flex 1
239
+ .vue-ui-group /deep/ > .indicator
240
+ padding-bottom 0 !important
251
241
252
242
$event-count-bubble-size = 18px
253
243
@@ -263,14 +253,10 @@ $event-count-bubble-size = 18px
263
253
position absolute
264
254
right 0
265
255
top 12px
266
- .dark &
256
+ .vue-ui- dark-mode &
267
257
background-color $dark-background-color
268
258
269
- .active-bar
270
- position absolute
271
- bottom 0
272
- width 0px
273
- height 3px
274
- background-color $active-color
275
- transition all .32s cubic-bezier (0 ,.9 ,.6 ,1 )
259
+ .container
260
+ overflow hidden
261
+ flex 1
276
262
</style >
0 commit comments