diff --git a/src/components/FromList/index.tsx b/src/components/FromList/index.tsx index c29daf5..156391f 100644 --- a/src/components/FromList/index.tsx +++ b/src/components/FromList/index.tsx @@ -1,61 +1,67 @@ +import { Input, Text, Textarea, View } from '@tarojs/components' +import { memo } from 'react' +import './index.scss' -import { Input, Text, Textarea, View } from "@tarojs/components" -import { memo } from "react" -import "./index.scss" - -interface ListParams{ - label: string, //左边label - onInput?: (ev:Object)=>void, // 输入框输入 - onClick?:()=>any, //点击列表 - placeholder?:string, // 提示文本 - children?: any, // 插槽 - type?: string // 类型:1.input,2.textarea,3.select, - primordialType?: 'text'|'number'|'idcard'|'digit' - value?: any, - style?: object, //整行样式 - labelStyle?: object, // label样式 - contentStyle?: object, +interface ListParams { + label: string //左边label + onInput?: (ev: Object) => void // 输入框输入 + onClick?: () => any //点击列表 + placeholder?: string // 提示文本 + children?: any // 插槽 + type?: string // 类型:1.input,2.textarea,3.select, + primordialType?: 'text' | 'number' | 'idcard' | 'digit' + value?: any + style?: object //整行样式 + labelStyle?: object // label样式 + contentStyle?: object required?: boolean } // 表单列表 -const FromList = memo((props:ListParams)=>{ - const {type="input",value="",style={},labelStyle={},contentStyle={},required=false} = props; - +const FromList = memo((props: ListParams) => { + const { type = 'input', value = '', style = {}, labelStyle = {}, contentStyle = {}, required = false } = props + return ( - - {props.label} - - { - props.children?? - - { - type=="input"? - - - {value&& - props.onInput&&props.onInput({detail: {value: ""}})} className="iconfont icon-qingkong"/> - } - : - type=="textarea"?