It is recommended to expose the node right click event
Closed this issue · 2 comments
a81n9 commented
It is recommended to expose the node right click event
phphe commented
use a custom div in the node slot, then you can listen on this div. check 3rd line
<Draggable class="mtl-tree" v-model="treeData" treeLine>
<template #default="{ node, stat }">
<div class="my-node-wrapper" @contextmenu="mycontextmenu">
<OpenIcon
v-if="stat.children.length"
:open="stat.open"
class="mtl-mr"
@click.native="stat.open = !stat.open"
/>
<input
class="mtl-checkbox mtl-mr"
type="checkbox"
v-model="stat.checked"
/>
<span class="mtl-ml">{{ node.text }}</span>
</div>
</template>
</Draggable>
a81n9 commented
use a custom div in the node slot, then you can listen on this div. check 3rd line
<Draggable class="mtl-tree" v-model="treeData" treeLine> <template #default="{ node, stat }"> <div class="my-node-wrapper" @contextmenu="mycontextmenu"> <OpenIcon v-if="stat.children.length" :open="stat.open" class="mtl-mr" @click.native="stat.open = !stat.open" /> <input class="mtl-checkbox mtl-mr" type="checkbox" v-model="stat.checked" /> <span class="mtl-ml">{{ node.text }}</span> </div> </template> </Draggable>
Thank you for your reply