未验证 提交 cbdad9cb 编写于 作者: 花裤衩 提交者: GitHub

fix[TagsView]: fix openMenu boundary display bug (#1256)

上级 1a345a7c
......@@ -121,11 +121,21 @@ export default {
this.$router.push('/')
},
openMenu(tag, e) {
this.visible = true
this.selectedTag = tag
const menuMinWidth = 105
const offsetLeft = this.$el.getBoundingClientRect().left // container margin left
this.left = e.clientX - offsetLeft + 15 // 15: margin right
const offsetWidth = this.$el.offsetWidth // container width
const maxLeft = offsetWidth - menuMinWidth // left boundary
const left = e.clientX - offsetLeft + 15 // 15: margin right
if (left > maxLeft) {
this.left = maxLeft
} else {
this.left = left
}
this.top = e.clientY
this.visible = true
this.selectedTag = tag
},
closeMenu() {
this.visible = false
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册