form render

form-render

gov form render

API

参数名 说明 必填 类型 默认值
url iframe 地址 string 'http://pre-recept.zjzwfw.gov.cn/form'
config iframe 地址参数 object
detail 是否为详情页面 boolean
height 组件初始高度 string
width 组件宽度 string '500px'
initCallback 组件加载回调 func

initCallback 返回接口函数

getFormData

入参 | 参数名 | 说明 | 必填 | 类型 | 默认值 | | ------ | ---- | ---- | ---- | ------ | | disableValid | 是否触发校验 | 否 | boolean | true | | scroll | 校验报错后是否滚动到对应字段 | 否 | boolean | true |

出参 | 参数名 | 说明 | 类型 | 举例 | | ------ | ---- | ---- | ---- | | success | 校验结果 | boolean | | | errorMsg | 错误信息 | array | | | content | 表单内容 | object | |

DEMO 列表

Simple Usage

本 Demo 演示一行文字的用法。

import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import FormRender from '@aligov/gov-form-render';

class App extends Component {
  handleClick() {
    this.form && this.form.getData().then(data => {
      console.log('获取表单数据', data);
    })
  }

  onFormReady(instance) {
    this.form = instance;
  }

  render() {
    return (
      <div>
        <FormRender initCallback={this.onFormReady.bind(this)}/>
        <button type="button" onClick={this.handleClick.bind(this)}>获取表单数据</button>
      </div>
    );
  }
}

ReactDOM.render((
  <App />
), mountNode);