holiber / sl-vue-tree

Customizable draggable tree component for Vue.js
MIT License
344 stars 79 forks source link

show context menu on responsive web when button clicked. not by right click event nodecontextmenu #61

Open xellos00 opened 5 years ago

xellos00 commented 5 years ago

I am trying to use this tree, but I tried to show contextMenu when it has click side icon that I gave it. right click to open context menu is working properly, but when I clicked bar to open context menu is not working. do you have any idea with it?

<template slot="sidebar" slot-scope="{ node }">
    <span class="visible-icon" style="padding:0px 3px 0px 10px; cursor:pointer" @click="event => showContextEllipsis(event, node)">
              <i  class="fa fa-ellipsis-v"></i>
            </span>
</template>

showContextEllipsis(event, node) { this.showContextMenu(node, event, 'clicked') },

showContextMenu(node, event, type) { event.preventDefault(); this.contextMenuIsVisible = true; const $contextMenu = this.$refs.contextmenu; console.log('X: ' + event.clientX+ ' :Y: '+ event.clientY); this.$refs.slVueTree.select(node.path); $contextMenu.style.left = event.clientX + 'px'; $contextMenu.style.top = event.clientY + 'px'; },

xellos00 commented 5 years ago

Dun worry, I figured out, I was kinda stupid with this. haha