Skip to content

Commit 2520b4d

Browse files
committed
fix(QDrawer): (backport from Qv2) always recompute belowBreakpoint on QLayout (when width changes) if containerized
1 parent 230c931 commit 2520b4d

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

ui/src/components/drawer/QDrawer.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,10 @@ export default Vue.extend({
114114
}
115115
},
116116

117-
'layout.totalWidth' (val) {
118-
this.__updateLocal('belowBreakpoint', (
119-
this.behavior === 'mobile' ||
120-
(this.behavior !== 'desktop' && val <= this.breakpoint)
121-
))
117+
'layout.totalWidth' () {
118+
if (this.layout.container === true || document.qScrollPrevented !== true) {
119+
this.__updateBelowBreakpoint()
120+
}
122121
},
123122

124123
side (newSide, oldSide) {
@@ -134,22 +133,17 @@ export default Vue.extend({
134133
this.layout[newSide].offset = this.offset
135134
},
136135

137-
behavior (val) {
138-
this.__updateLocal('belowBreakpoint', (
139-
val === 'mobile' ||
140-
(val !== 'desktop' && this.layout.totalWidth <= this.breakpoint)
141-
))
136+
behavior () {
137+
this.__updateBelowBreakpoint()
142138
},
143139

144-
breakpoint (val) {
145-
this.__updateLocal('belowBreakpoint', (
146-
this.behavior === 'mobile' ||
147-
(this.behavior !== 'desktop' && this.layout.totalWidth <= val)
148-
))
140+
breakpoint () {
141+
this.__updateBelowBreakpoint()
149142
},
150143

151144
'layout.container' (val) {
152145
this.showing === true && this.__preventScroll(val !== true)
146+
val === true && this.__updateBelowBreakpoint()
153147
},
154148

155149
'layout.scrollbarWidth' () {
@@ -583,6 +577,13 @@ export default Vue.extend({
583577

584578
__updateSizeOnLayout (miniToOverlay, size) {
585579
this.__update('size', miniToOverlay === true ? this.miniWidth : size)
580+
},
581+
582+
__updateBelowBreakpoint () {
583+
this.__updateLocal('belowBreakpoint', (
584+
this.behavior === 'mobile' ||
585+
(this.behavior !== 'desktop' && this.layout.totalWidth <= this.breakpoint)
586+
))
586587
}
587588
},
588589

0 commit comments

Comments
 (0)