import React from 'react'; import { View } from '@tarojs/components'; import Input from '../../components/input'; import { CompDefault, MetaProps } from '../data-channel'; import connect from '../connect'; export interface Props extends MetaProps { // 标签 label?: string; // 是否必填 require?: boolean; // 数据输出回调 onChange?: Function; } export interface State {} const defaultValue: CompDefault = { props: { label: '', require: false, onChange: (_value) => {}, }, state: {}, meta: { compName: 'inline', output: { tags: ['form-item'] }, __mergeCb: (props, meta) => { meta.output.key = props.formKey; }, }, }; /** * 表单项-输入框 */ const FormItemInput: React.FC = ({ label, onChange, meta }) => { return ( { onChange({ value: e.detail.value, meta: meta.output, }); }} /> ); }; export default connect(FormItemInput, defaultValue);