@@ -41,8 +49,8 @@ export default {
default: ''
},
menuWidth: {
- type: String,
- default: '192px'
+ type: Number,
+ default: 192
}
},
data() {
@@ -52,12 +60,18 @@ export default {
events: ['mousedown'],
isActive: true
},
+ submenuWidth: 144,
showMenu: false,
mouseoverItemIndex: null,
- isOverSubItemMenu: false
+ isOverSubItemMenu: false,
+ openSubMenuLeft: false
+ }
+ },
+ computed: {
+ submenuLeftPos() {
+ return this.openSubMenuLeft ? -(this.submenuWidth - 1) : this.menuWidth - 0.5
}
},
- computed: {},
methods: {
mouseoverSubItemMenu(index) {
this.isOverSubItemMenu = true
@@ -80,6 +94,12 @@ export default {
clickShowMenu() {
if (this.disabled) return
this.showMenu = !this.showMenu
+ this.$nextTick(() => {
+ const boundingRect = this.$refs.menuWrapper?.getBoundingClientRect()
+ if (boundingRect) {
+ this.openSubMenuLeft = window.innerWidth - boundingRect.x < this.menuWidth + this.submenuWidth + 5
+ }
+ })
},
clickedOutside() {
this.showMenu = false
diff --git a/client/components/widgets/MoreMenu.vue b/client/components/widgets/MoreMenu.vue
index 9f7538e0..15bd7725 100644
--- a/client/components/widgets/MoreMenu.vue
+++ b/client/components/widgets/MoreMenu.vue
@@ -1,11 +1,11 @@
-
+
-
+
-
+
@@ -33,11 +33,18 @@ export default {
events: ['mousedown'],
isActive: true
},
+ submenuWidth: 144,
+ menuWidth: 144,
mouseoverItemIndex: null,
- isOverSubItemMenu: false
+ isOverSubItemMenu: false,
+ openSubMenuLeft: false
+ }
+ },
+ computed: {
+ submenuLeftPos() {
+ return this.openSubMenuLeft ? -this.submenuWidth : this.menuWidth - 1.5
}
},
- computed: {},
methods: {
mouseoverSubItemMenu(index) {
this.isOverSubItemMenu = true
@@ -77,7 +84,14 @@ export default {
this.$el.parentNode.removeChild(this.$el)
}
},
- mounted() {},
+ mounted() {
+ this.$nextTick(() => {
+ const boundingRect = this.$refs.wrapper?.getBoundingClientRect()
+ if (boundingRect) {
+ this.openSubMenuLeft = window.innerWidth - boundingRect.x < this.menuWidth + this.submenuWidth + 5
+ }
+ })
+ },
beforeDestroy() {}
}
\ No newline at end of file
diff --git a/client/pages/item/_id/index.vue b/client/pages/item/_id/index.vue
index b41302c8..ecdfe3f7 100644
--- a/client/pages/item/_id/index.vue
+++ b/client/pages/item/_id/index.vue
@@ -122,7 +122,7 @@
-
+