@zwight/g6-extension-vue
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

Vue extension for G6

This extension allows you to define G6 node by Vue component and JSX syntax.

Usage

  1. Install
npm install @zwight/g6-extension-vue
  1. Import and Register
import { ExtensionCategory, register } from '@antv/g6';
import { VueNode } from '@zwight/g6-extension-vue';

register(ExtensionCategory.NODE, 'vue', VueNode);
  1. Define Node

Vue Node:

const VueNode = () => {
  return <div>node</div>;
};
<script setup lang="ts">
</script>

<template>
    <div>vue node</div>
</template>
  1. Use

Use VueNode:

const graph = new Graph({
  // ... other options
  node: {
    type: 'vue',
    style: {
      component: () => <VueNode />,
    },
  },
});

Thanks

This plugin draws inspiration from @antv/g6-extension-react

/@zwight/g6-extension-vue/

    Package Sidebar

    Install

    npm i @zwight/g6-extension-vue

    Weekly Downloads

    97

    Version

    0.0.6

    License

    MIT

    Unpacked Size

    8.79 kB

    Total Files

    20

    Last publish

    Collaborators

    • zwight