add example

This commit is contained in:
hufeixiong
2021-07-10 19:35:06 +08:00
parent b1133c8773
commit c27b4eb8e0
50 changed files with 5786 additions and 212 deletions

View File

@@ -0,0 +1,21 @@
/*
* @Author: yehuozhili
* @Date: 2021-07-07 14:29:38
* @LastEditors: yehuozhili
* @LastEditTime: 2021-07-09 13:51:32
* @FilePath: \dooringx\packages\dooringx-example\src\plugin\registFormComponents.ts
*
*/
import { ComponentClass } from 'react';
import { FunctionComponent } from 'react';
const modulesFiles = (require as any).context('./formComponents', true, /\.(js|tsx)$/);
export const Formmodules: Record<string, FunctionComponent<any> | ComponentClass<any, any>> =
modulesFiles.keys().reduce((modules: any, modulePath: any) => {
const tmp = modulePath.split('.');
const name = tmp[tmp.length - 2].slice(1);
const value = modulesFiles(modulePath);
modules[name] = value.default;
return modules;
}, []);