如何主动触发自定义指令
#2614
Replies: 4 comments 4 replies
-
比较取巧的办法, 通过change:data, 根据data的数据和节点的shape来判断执行 |
Beta Was this translation helpful? Give feedback.
0 replies
-
遇到了同样的问题,可以利用在graph上绑定自定义监听来实现: MainView.vue
const graph = new Graph({
xxxx
});
graph.on('node:plus', (nodeData) =>{
// do some thing
}) 然后在自定义节点(组件)上触发该事件: CustomNode.vue
export default {
name: 'CustomNode',
inject: ['getNode', 'getGraph'],
methods:{
onTriggerPlus(){
const node = this.getNode();
const nodeData = node.getData();
const graph = this.getGraph();
graph.trigger('node:plus', nodeData);
}
}
} |
Beta Was this translation helpful? Give feedback.
4 replies
-
这是来自QQ邮箱的假期自动回复邮件。
你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。
|
Beta Was this translation helpful? Give feedback.
0 replies
-
这是来自QQ邮箱的假期自动回复邮件。
你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
目前基于vite vue. antv/x6搭建了一个项目,
vue自定义组件已经可以很好的嵌入到 节点中了,
没有发现可以自定义事件的地方,文档中只有一个node.attr 绑定一个图片在图片上绑定点击事件
想在vue组件中 实现,点击一个按钮 主动触发 自定义事件(node: plus),
再在graph 监听事件
1、无法注册自定义事件
2、没法主动触发自定义事件
Beta Was this translation helpful? Give feedback.
All reactions