2
0
mirror of https://github.com/tenrok/vue-context.git synced 2026-06-05 01:42:23 +03:00

Add prop to handle offset of subMenu (#50)

Adds `subMenuOffset` prop, so one can set the left-offset of the sub-menus.
This commit is contained in:
Ignacio Durand
2020-03-19 10:21:10 -03:00
committed by GitHub
parent 9b75951500
commit 37f86a84e0
+5 -1
View File
@@ -41,6 +41,10 @@ export default {
tag: {
type: String,
default: 'ul'
},
subMenuOffset: {
type: Number,
default: 10
}
},
@@ -236,7 +240,7 @@ export default {
// first set the display and afterwards execute position calculation for correct element offsets
subMenuElement.style.display = 'block';
let [elementTop, elementLeft] = this.positionMenu(bcr.top, bcr.right - 10, subMenuElement);
let [elementTop, elementLeft] = this.positionMenu(bcr.top, bcr.right - (this.subMenuOffset), subMenuElement);
subMenuElement.style.left = `${elementLeft}px`;
subMenuElement.style.top = `${elementTop}px`;