yunli-smart-fe-ui
v2.0.7
Published
## IOCFormRender
Downloads
483
Keywords
Readme
smart-fe-ui 私有组件库
IOCFormRender
import React, { Component } from 'react';
import { IocFormRender } from 'yunli-smart-fe-ui';
import { getWidgetOption } from './widgetDefaultOption';
import Cookies from 'js-cookie';
export default class FormPreview extends Component {
constructor(props) {
super(props);
const { layoutData = [], verifyCondition } = props;
this.state = {
layoutJSON: layoutData,
verifyCondition: verifyCondition
};
this.form = null;
}
onSubmit = () => {
this.form.form
.validateFields()
.then((values) => {
console.log(values);
})
.catch((err) => {});
};
onResetField = () => {
this.form.form.resetFields();
};
render() {
const { layoutJSON = {}, verifyCondition, fieldEffect } = this.state;
return (
<React.Fragment>
<IocFormRender
renderType="editor"
ref={(form) => (this.form = form)}
layoutJson={layoutJSON}
verifyCondition={verifyCondition}
editMode="edit"
headers={{ token: `${Cookies.get('token')}` }}
uploadUrl="/a/b/c",
requestPrefix="/api"
/>
</React.Fragment>
);
}
}
| 描述 | 类型 | 默认值 | 描述 | | --------------- | -------- | -------- | ------------------------------------ | | renderType | string | 'editor' | 渲染类型 'editor', 'preview' | | ref | function | - | | | layoutJson | object | - | | | verifyCondition | object | - | | | editMode | string | - | 可编辑类型 'edit', 'add', 'edit,add' | | headers | object | - | 请求header | | requestPrefix | string | - | 请求前缀 | | uploadUrl | string | - | 上传地址 | | directoryPaths | string | - | 上传文件路径 |