@mouseup="clickAttribute"
// 阻止鼠标右键浏览器默认行为
preventMouse () {
this.$refs.shuxingBox.oncontextmenu = function () { return false }
},
// 鼠标右键事件
clickAttribute (e) {
this.preventMouse()
if (e.button === 2) {
this.$refs.shuxingBox.style.top = (e.offsetY + 70) + 'px'
this.$refs.shuxingBox.style.left = (e.offsetX + 20) + 'px'
this.$refs.shuxingBox.style.display = 'block'
} else {
this.$refs.shuxingBox.style.display = 'none'
}
}
网友评论