@zwight/g6-extension-vue
v0.0.8
Published
Using Vue Component to Define Your G6 Graph Node
Downloads
97
Readme
Vue extension for G6
This extension allows you to define G6 node by Vue component and JSX syntax.
Usage
- Install
npm install @zwight/g6-extension-vue
- Import and Register
import { ExtensionCategory, register } from '@antv/g6';
import { VueNode } from '@zwight/g6-extension-vue';
register(ExtensionCategory.NODE, 'vue', VueNode);
- Define Node
Vue Node:
JSX Component
const VueNode = () => {
return <div>node</div>;
};
OR Vue Component
<script setup lang="ts">
</script>
<template>
<div>vue node</div>
</template>
- Use
Use VueNode:
<script setup lange="tsx">
import VueNode from vueNode.vue;
const graph = new Graph({
// ... other options
node: {
type: 'vue',
style: {
component: () => <VueNode />,
},
},
});
</script>
Thanks
This plugin draws inspiration from @antv/g6-extension-react