Coder Social home page Coder Social logo

Comments (5)

noonnightstorm avatar noonnightstorm commented on May 5, 2024

现在暂时只支持和react配合使用,暂时还不能和vue配合使用,抱歉

from butterfly.

bigfacewo avatar bigfacewo commented on May 5, 2024

@noonnightstorm 好的 谢谢回复

from butterfly.

LaveyD avatar LaveyD commented on May 5, 2024
// index.vue
<template>
  <div id="dag-canvas"></div>
</template>

<script>
import FlowChartCanvas from './canvas';
import { mockData } from './data';

const Node = require('./node.js');

export default {
  name: 'FlowChart',
  mounted() {
    const root = document.getElementById('dag-canvas');
    this.canvas = new FlowChartCanvas({
       root,
       ...
     });
    this.canvas.draw(mockData, {}, () => {
      this.canvas.focusCenterWithAnimate();
    });
    this.canvas.on('events', (data) => {
      console.log(data);
    });
  },
}
</script>

<style lang="less">
@import '~butterfly-dag/pack/index.css';
@import './node.less';
</style>
// canvas.js
import { Canvas } from 'butterfly-dag/pack/index';

class FlowChartCanvas extends Canvas {
  constructor(...args) {
    super(...args);
    this.listenEventProxy();
  }
  listenEventProxy() {}
  ...
}

export default FlowChartCanvas;

node.js 和example里的基本一样

from butterfly.

noonnightstorm avatar noonnightstorm commented on May 5, 2024
// index.vue
<template>
  <div id="dag-canvas"></div>
</template>

<script>
import FlowChartCanvas from './canvas';
import { mockData } from './data';

const Node = require('./node.js');

export default {
  name: 'FlowChart',
  mounted() {
    const root = document.getElementById('dag-canvas');
    this.canvas = new FlowChartCanvas({
       root,
       ...
     });
    this.canvas.draw(mockData, {}, () => {
      this.canvas.focusCenterWithAnimate();
    });
    this.canvas.on('events', (data) => {
      console.log(data);
    });
  },
}
</script>

<style lang="less">
@import '~butterfly-dag/pack/index.css';
@import './node.less';
</style>
// canvas.js
import { Canvas } from 'butterfly-dag/pack/index';

class FlowChartCanvas extends Canvas {
  constructor(...args) {
    super(...args);
    this.listenEventProxy();
  }
  listenEventProxy() {}
  ...
}

export default FlowChartCanvas;

node.js 和example里的基本一样

我这两天会写一个react最佳实践,请问到时候方便贡献一下文档,提供个vue最佳实践呢?

from butterfly.

LaveyD avatar LaveyD commented on May 5, 2024
// index.vue
<template>
  <div id="dag-canvas"></div>
</template>

<script>
import FlowChartCanvas from './canvas';
import { mockData } from './data';

const Node = require('./node.js');

export default {
  name: 'FlowChart',
  mounted() {
    const root = document.getElementById('dag-canvas');
    this.canvas = new FlowChartCanvas({
       root,
       ...
     });
    this.canvas.draw(mockData, {}, () => {
      this.canvas.focusCenterWithAnimate();
    });
    this.canvas.on('events', (data) => {
      console.log(data);
    });
  },
}
</script>

<style lang="less">
@import '~butterfly-dag/pack/index.css';
@import './node.less';
</style>
// canvas.js
import { Canvas } from 'butterfly-dag/pack/index';

class FlowChartCanvas extends Canvas {
  constructor(...args) {
    super(...args);
    this.listenEventProxy();
  }
  listenEventProxy() {}
  ...
}

export default FlowChartCanvas;

node.js 和example里的基本一样

我这两天会写一个react最佳实践,请问到时候方便贡献一下文档,提供个vue最佳实践呢?

好的,这个组件挺好用的,赞

from butterfly.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.