antvis/G6








The issue has been closed
在vue中graph.on('canvas:dblclick',fn)不生效 #4855
padeyao4 posted onGitHub
Describe the bug
在vue中graph.on('dblclick',fn) 有效果 graph.on('canvas:dblclick',fn) 不生效
Your Example Website or App
xxx
Steps to Reproduce the Bug or Issue
正常创建 vue 项目 cnpm init vue@latest cnpm i @antv/g6 --save
<script setup lang="ts">
import { Graph } from '@antv/g6';
import { onMounted, ref } from 'vue'
let root = ref<HTMLElement>()
let graph = ref<Graph>()
onMounted(() => {
const data = {
// 点集
nodes: [
{
id: 'node1',
x: 100,
y: 200,
},
{
id: 'node2',
x: 300,
y: 200,
},
],
// 边集
edges: [
// 表示一条从 node1 节点连接到 node2 节点的边
{
source: 'node1',
target: 'node2',
},
],
};
graph.value = new Graph({
container: root.value!,
})
graph.value.on('canvas:dblclick', () => {
console.log('canvas:dblclick')
})
graph.value.on('node:dblclick', () => {
console.log('node:dblclick')
})
graph.value.on('dblclick', () => {
console.log('dblclick')
})
graph.value.read(data)
})
</script>
<template>
<div ref="root" style="width: 100% ; height: 800px; background-color: antiquewhite"></div>
</template>
Expected behavior
正常情况下 双击canvas打印信息
实际情况 双击canvas没有效果
Screenshots or Videos
No response
Platform
- OS: [Linux]
- Browser: [Edge]
- Version: [4.8.21]
Additional context
No response