File tree 2 files changed +30
-16
lines changed
2 files changed +30
-16
lines changed Original file line number Diff line number Diff line change 175
175
]
176
176
},
177
177
events: {
178
- headings: [' Name' , ' Description' , ' Value' ],
179
- props: [
180
- {
181
- name: ' md-opened' ,
182
- description: ' Triggered when menu opens' ,
183
- value: ' null'
184
- },
185
- {
186
- name: ' md-closed' ,
187
- description: ' Triggered when menu closes' ,
188
- value: ' null'
189
- }
190
- ]
191
- }
178
+ headings: [' Name' , ' Description' , ' Value' ],
179
+ props: [
180
+ {
181
+ name: ' md-opened' ,
182
+ description: ' Triggered when menu opens' ,
183
+ value: ' null'
184
+ },
185
+ {
186
+ name: ' md-closed' ,
187
+ description: ' Triggered when menu closes' ,
188
+ value: ' null'
189
+ }
190
+ ]
191
+ }
192
192
})
193
193
}
194
194
</script >
Original file line number Diff line number Diff line change 181
181
this .MdMenu .active = false
182
182
},
183
183
getOffsets () {
184
+ const relativePosition = this .getBodyPosition ()
185
+
186
+ const offsetX = this .MdMenu .offsetX || 0
187
+ const offsetY = this .MdMenu .offsetY || 0
188
+
184
189
return {
185
- offsetX: this . MdMenu . offsetX || 0 ,
186
- offsetY: this . MdMenu . offsetY || 0
190
+ offsetX: offsetX - relativePosition . x ,
191
+ offsetY: offsetY - relativePosition . y
187
192
}
188
193
},
189
194
hasCustomOffsets () {
221
226
max-width: ${ this .MdMenu .instance .$el .offsetWidth } px
222
227
`
223
228
}
229
+ },
230
+ getBodyPosition () {
231
+ const body = document .body
232
+ const { top , left } = body .getBoundingClientRect ()
233
+
234
+ const scrollLeft = window .pageXOffset !== undefined ? window .pageXOffset : body .scrollLeft
235
+ const scrollTop = window .pageYOffset !== undefined ? window .pageYOffset : body .scrollTop
236
+
237
+ return { x: left + scrollLeft, y: top + scrollTop }
224
238
}
225
239
},
226
240
mounted () {
You can’t perform that action at this time.
0 commit comments