@@ -22,7 +22,6 @@ export default {
22
22
data ( ) {
23
23
return {
24
24
isActive : false ,
25
- isBooted : false ,
26
25
isMobile : null ,
27
26
touchArea : {
28
27
left : 0 ,
@@ -74,13 +73,12 @@ export default {
74
73
'navigation-drawer' : true ,
75
74
'navigation-drawer--absolute' : this . absolute ,
76
75
'navigation-drawer--clipped' : this . clipped ,
77
- 'navigation-drawer--close' : ! this . isBooted || ! this . isActive ,
76
+ 'navigation-drawer--close' : ! this . isActive ,
78
77
'navigation-drawer--fixed' : this . fixed ,
79
78
'navigation-drawer--floating' : this . floating ,
80
- 'navigation-drawer--is-booted' : this . isBooted ,
81
79
'navigation-drawer--is-mobile' : this . isMobile ,
82
80
'navigation-drawer--mini-variant' : this . miniVariant ,
83
- 'navigation-drawer--open' : this . isActive && this . isBooted ,
81
+ 'navigation-drawer--open' : this . isActive ,
84
82
'navigation-drawer--right' : this . right ,
85
83
'navigation-drawer--temporary' : this . temporary ,
86
84
'theme--dark' : this . dark ,
@@ -104,14 +102,24 @@ export default {
104
102
? this . $vuetify . application . top + this . $vuetify . application . bottom
105
103
: this . $vuetify . application . bottom
106
104
} ,
107
- reactsToMobile ( ) {
105
+ reactsToClick ( ) {
108
106
return ! this . stateless &&
109
- ! this . disableResizeWatcher &&
110
- this . isBooted &&
107
+ ! this . permanent &&
108
+ ( this . isMobile || this . temporary )
109
+ } ,
110
+ reactsToMobile ( ) {
111
+ return ! this . disableResizeWatcher &&
112
+ ! this . stateless &&
113
+ ! this . permanent &&
111
114
! this . temporary
112
115
} ,
113
116
reactsToRoute ( ) {
114
- return ! this . disableRouteWatcher && ! this . stateless
117
+ return ! this . disableRouteWatcher &&
118
+ ! this . stateless &&
119
+ ! this . permanent
120
+ } ,
121
+ resizeIsDisabled ( ) {
122
+ return this . disableResizeWatcher || this . stateless
115
123
} ,
116
124
showOverlay ( ) {
117
125
return this . isActive &&
@@ -136,12 +144,10 @@ export default {
136
144
isActive ( val ) {
137
145
this . $emit ( 'input' , val )
138
146
139
- if ( ! this . isBooted ||
140
- ( ! this . temporary && ! this . isMobile )
141
- ) return
142
-
143
- this . tryOverlay ( )
144
- this . $el . scrollTop = 0
147
+ if ( this . temporary || this . isMobile ) {
148
+ this . tryOverlay ( )
149
+ this . $el . scrollTop = 0
150
+ }
145
151
} ,
146
152
/**
147
153
* When mobile changes, adjust
@@ -150,24 +156,21 @@ export default {
150
156
* value
151
157
*/
152
158
isMobile ( val , prev ) {
153
- ! val && this . isActive && this . removeOverlay ( )
159
+ ! val &&
160
+ this . isActive &&
161
+ ! this . temporary &&
162
+ this . removeOverlay ( )
154
163
155
- if ( ! this . reactsToMobile ) return
164
+ if ( prev == null ||
165
+ this . resizeIsDisabled
166
+ ) return
156
167
157
- if ( prev != null && ! this . temporary ) {
158
- this . isActive = ! val
159
- }
168
+ this . isActive = ! val
160
169
} ,
161
170
permanent ( val ) {
162
- // If we are removing prop
163
- // reset active to match
164
- // current value
165
- if ( ! val ) return ( this . isActive = this . value )
166
-
167
- // We are enabling prop
168
- // set its state to match
169
- // viewport size
170
- this . isActive = ! this . isMobile
171
+ // If enabling prop
172
+ // enable the drawer
173
+ if ( val ) this . isActive = true
171
174
} ,
172
175
right ( val , prev ) {
173
176
// When the value changes
@@ -180,34 +183,27 @@ export default {
180
183
this . updateApplication ( )
181
184
} ,
182
185
temporary ( val ) {
183
- if ( ! val ) return
184
-
185
186
this . tryOverlay ( )
186
187
} ,
187
188
value ( val ) {
188
- if ( this . permanent && ! this . isMobile ) return
189
+ if ( this . permanent ) return
190
+
189
191
if ( val !== this . isActive ) this . isActive = val
190
192
}
191
193
} ,
192
194
193
- mounted ( ) {
195
+ beforeMount ( ) {
194
196
this . checkIfMobile ( )
195
197
196
- // Same as 3rd conditional
197
- // but has higher precedence
198
- // than simply providing
199
- // a default value
200
- if ( this . stateless ) {
201
- this . isActive = this . value
202
- } else if ( this . permanent && ! this . isMobile ) {
198
+ if ( this . permanent ) {
203
199
this . isActive = true
204
- } else if ( this . value != null ) {
200
+ } else if ( this . stateless ||
201
+ this . value != null
202
+ ) {
205
203
this . isActive = this . value
206
204
} else if ( ! this . temporary ) {
207
205
this . isActive = ! this . isMobile
208
206
}
209
-
210
- setTimeout ( ( ) => ( this . isBooted = true ) , 0 )
211
207
} ,
212
208
213
209
destroyed ( ) {
@@ -227,10 +223,14 @@ export default {
227
223
}
228
224
} ,
229
225
checkIfMobile ( ) {
226
+ if ( this . permanent ||
227
+ this . temporary
228
+ ) return
229
+
230
230
this . isMobile = window . innerWidth < parseInt ( this . mobileBreakPoint , 10 )
231
231
} ,
232
232
closeConditional ( ) {
233
- return ! this . stateless && ( this . isMobile || this . temporary )
233
+ return this . reactsToClick
234
234
} ,
235
235
genDirectives ( ) {
236
236
const directives = [
@@ -280,7 +280,10 @@ export default {
280
280
else if ( ! this . right && this . isActive ) this . isActive = false
281
281
} ,
282
282
tryOverlay ( ) {
283
- if ( this . showOverlay && this . isActive ) {
283
+ if ( ! this . permanent &&
284
+ this . showOverlay &&
285
+ this . isActive
286
+ ) {
284
287
return this . genOverlay ( )
285
288
}
286
289
@@ -290,8 +293,8 @@ export default {
290
293
if ( ! this . app ) return
291
294
292
295
const width = ! this . isActive ||
293
- this . isMobile ||
294
- this . temporary
296
+ this . temporary ||
297
+ this . isMobile
295
298
? 0
296
299
: this . calculatedWidth
297
300
0 commit comments