@cainiaofe/cn-ui-m
Version:
49 lines (48 loc) • 1.58 kB
JavaScript
import React from 'react';
import { CnDemoPage, CnDynamicForm, CnMessage } from "../../..";
var Schema = [
{
name: 'name',
title: '花名',
required: true,
component: 'CnInput',
},
{
name: 'address',
title: '办公地址',
required: true,
component: 'CnInput',
},
{
name: 'field3',
title: '字段3',
component: 'CnSelect',
'component-props': {
dataSource: [
{ label: '选项1', value: 1 },
{ label: '选项2', value: 2 },
],
},
},
{
name: 'field4',
title: '字段4',
component: 'CnInput',
},
];
export var 提交数据源 = function () { return (React.createElement(CnDemoPage, { title: "\u63D0\u4EA4\u6570\u636E\u6E90" },
React.createElement(CnDynamicForm, { hasFooterSubmit: true, schema: Schema, initRequestConfig: {
url: 'https://mocks.alibaba-inc.com/mock/cndynamicform/example/getInitialValues',
}, submitRequestConfig: {
url: 'https://mocks.alibaba-inc.com/mock/cndynamicform/example/submitValues',
method: 'POST',
onSuccess: function (message) {
console.log('请求成功', message);
CnMessage.success('请求成功!');
},
onError: function (error) {
console.log('请求失败', error);
CnMessage.error('请求失败!');
},
} }))); };
export default { title: 'demo/CnDynamicForm' };