update doc

This commit is contained in:
hufeixiong
2021-08-05 15:32:03 +08:00
parent 90a4ce0285
commit 6531d6c496
3 changed files with 6 additions and 8 deletions

View File

@@ -45,7 +45,6 @@ const MButton = new ComponentItemFactory(
createPannelOptions<FormMap, 'input'>('input', { createPannelOptions<FormMap, 'input'>('input', {
receive: 'text', receive: 'text',
label: '文字', label: '文字',
text: 'yehuozhili',
}), }),
], ],
animate: [createPannelOptions<FormMap, 'animateControl'>('animateControl', {})], animate: [createPannelOptions<FormMap, 'animateControl'>('animateControl', {})],
@@ -54,6 +53,7 @@ const MButton = new ComponentItemFactory(
{ {
props: { props: {
... ...
text:'yehuozhili'// input配置项组件接收的初始值
}, },
}, },
(data, context, store, config) => { (data, context, store, config) => {

View File

@@ -22,7 +22,6 @@ export interface FormBaseType {
} }
export interface FormInputType extends FormBaseType { export interface FormInputType extends FormBaseType {
label: string; label: string;
text: string;
} }
export interface FormActionButtonType {} export interface FormActionButtonType {}
export interface FormAnimateControlType {} export interface FormAnimateControlType {}
@@ -34,7 +33,7 @@ export interface FormMap {
``` ```
formMap的键名就是initFormComponents键名formMap的值对应组件需要收到的值。 formMap的键名就是initFormComponents键名formMap的值对应组件需要收到的值。
以input组件为例FormInputType此时有3个属性label,text,receive。 以input组件为例FormInputType此时有2个属性label,receive。
那么在其开发该组件时props会收到 那么在其开发该组件时props会收到
@@ -55,7 +54,6 @@ style: [
createPannelOptions<FormMap, 'input'>('input', { createPannelOptions<FormMap, 'input'>('input', {
receive: 'text', receive: 'text',
label: '文字', label: '文字',
text: 'yehuozhili',
}), }),
], ],

View File

@@ -2,7 +2,7 @@
* @Author: yehuozhili * @Author: yehuozhili
* @Date: 2021-07-07 14:32:55 * @Date: 2021-07-07 14:32:55
* @LastEditors: yehuozhili * @LastEditors: yehuozhili
* @LastEditTime: 2021-07-13 15:07:08 * @LastEditTime: 2021-08-05 15:27:21
* @FilePath: \dooringx\packages\dooringx-example\src\plugin\formComponents\input.tsx * @FilePath: \dooringx\packages\dooringx-example\src\plugin\formComponents\input.tsx
*/ */
import { deepCopy, UserConfig } from 'dooringx-lib'; import { deepCopy, UserConfig } from 'dooringx-lib';
@@ -21,17 +21,17 @@ interface MInputProps {
function MInput(props: MInputProps) { function MInput(props: MInputProps) {
const option = useMemo(() => { const option = useMemo(() => {
return props.data?.option || {}; return props.data.option || {};
}, [props.data]); }, [props.data]);
const store = props.config.getStore(); const store = props.config.getStore();
return ( return (
<Row style={{ padding: '10px 20px' }}> <Row style={{ padding: '10px 20px' }}>
<Col span={6} style={{ lineHeight: '30px' }}> <Col span={6} style={{ lineHeight: '30px' }}>
{(option as any)?.label || '文字'} {option.label || '文字'}
</Col> </Col>
<Col span={18}> <Col span={18}>
<Input <Input
value={props.current.props[(option as any).receive] || ''} value={props.current.props[option.receive!] || ''}
onChange={(e) => { onChange={(e) => {
const receive = (option as any).receive; const receive = (option as any).receive;
const clonedata = deepCopy(store.getData()); const clonedata = deepCopy(store.getData());