1. 程式人生 > >vue右鍵事件——顯示iview選單欄

vue右鍵事件——顯示iview選單欄

先取消右鍵的預設事件

e.preventDefault()

獲取當前點選的標籤

this.$refs.contextMenu.$refs.reference = event.target

顯示選單欄

this.$refs.contextMenu.currentVisible = true

然後設定選單欄顯示的位置

效果圖: