Giter VIP home page Giter VIP logo

Comments (9)

gaoli avatar gaoli commented on May 18, 2024

@Yeung2017 使用 withPropsAPI 包装组件,具体使用参照 这里

from ggeditor.

Yeung2017 avatar Yeung2017 commented on May 18, 2024

@gaoli 谢谢,这个方法很方便.是我自己没有仔细看文档.

from ggeditor.

hannaqiong avatar hannaqiong commented on May 18, 2024

看了withPropsAPI 文档,还是不知道怎么调用save,可以把代码贴出来看下吗?

from ggeditor.

gaoli avatar gaoli commented on May 18, 2024

@hannaqiong

import { withPropsAPI } from 'gg-editor';

class Component extends React.Component {
  componentDidMount() {
    const { propsAPI } = this.props;
    const { save } =  propsAPI;

    console.log(save());
  }
}

export default withPropsAPI(Component);

from ggeditor.

hannaqiong avatar hannaqiong commented on May 18, 2024
import React from 'react';
import { Flow, withPropsAPI } from '@src';
import styles from './index.scss';
import { Button } from '../../../../node_modules/antd';
class FlowWithPropsAPI extends React.Component {
constructor(props){
    super(props);
}

saveFlow = () =>{
    console.log(this.props.propsAPI.save());
}

render() {
    return(
       <div>
           <Flow
               className={styles.flow}
               style={{height: 600}}
          />
          <Button onClick={this.saveFlow}>保存流程图</Button>
        </div>
    );
  }
}

from ggeditor.

zsl1549 avatar zsl1549 commented on May 18, 2024

懂了
@gaoli 谢谢。

from ggeditor.

 avatar commented on May 18, 2024

image
请问下问题出在哪里呢?

from ggeditor.

gaoli avatar gaoli commented on May 18, 2024

@yinbanghui 请提供下在线的 DEMO,谢谢:)

from ggeditor.

top-soft avatar top-soft commented on May 18, 2024

同样按照楼上的withPropsAPI 的方式未能获取到,this.props.propsAPI 为一个空对象{},暂时用的楼主的方法 ref graph.save解决
image

from ggeditor.

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.