\FormBuilder\componentsUpload

上传组件 Class Upload

Summary

Methods
Properties
Constants
__construct()
col()
setProps()
getProps()
value()
getValue()
getField()
getTitle()
required()
validate()
__call()
headers()
format()
data()
build()
()
()
()
()
()
()
()
()
No public properties found
TYPE_FILE
TYPE_IMAGE
init()
setRequired()
$field
$title
$name
$props
$value
$col
$validate
$propsRule
N/A
No private methods found
No private properties found
N/A

Constants

TYPE_FILE

TYPE_FILE = 'file'

file类型

TYPE_IMAGE

TYPE_IMAGE = 'image'

image类型

Properties

$field

$field : String

字段名

Type

String

$title

$title : String

字段昵称

Type

String

$name

$name : string

组件名称

Type

string

$props

$props : array

组件的规则

Type

array

$value

$value : 

字段的值

Type

$col

$col : array

栅格规则

Type

array

$validate

$validate : array

字段验证规则

Type

array

$propsRule

$propsRule : array

组件属性设置规则

Type

array

Methods

__construct()

__construct(String  $field, String  $title, String  $value = null) 

FormComponentDriver constructor.

Parameters

String $field

字段名

String $title

字段昵称

String $value

字段值

col()

col(  $span) : $this

Parameters

$span

Returns

$this

setProps()

setProps(array  $props = array()) : $this

批量设置组件的规则

Parameters

array $props

Returns

$this

getProps()

getProps(  $name) : mixed|null

获取组件的规则

Parameters

$name

Returns

mixed|null

value()

value(string|array  $value) : $this

设置组件的值

Parameters

string|array $value

Returns

$this

getValue()

getValue() : string

获取组件的值

Returns

string

getField()

getField() : String

获取组件的字段名

Returns

String

getTitle()

getTitle() : String

设置组件的昵称

Returns

String

required()

required(null  $message = null, string  $trigger = 'change') : $this

Parameters

null $message
string $trigger

Returns

$this

validate()

validate(array  $validate) : $this

添加验证规则

Parameters

array $validate

Returns

$this

__call()

__call(  $name,   $arguments) : $this

设置组件属性

Parameters

$name
$arguments

Throws

\Exception

Returns

$this

headers()

headers(array  $headers) : $this

设置上传的请求头部

Parameters

array $headers

Returns

$this

format()

format(array  $format) : $this

支持的文件类型,与 accept 不同的是, format 是识别文件的后缀名,accept 为 input 标签原生的 accept 属性, 会在选择文件时过滤,可以两者结合使用

Parameters

array $format

Returns

$this

data()

data(array  $data) : $this

上传时附带的额外参数

Parameters

array $data

Returns

$this

build()

build() : array

Returns

array

()

() : 

$this uploadType(String $uploadType) 上传文件类型,可选值为 image(图片上传),file(文件上传)

Returns

()

() : 

$this action(String $action) 上传的地址

Returns

()

() : 

$this multiple(Boolean $bool) 是否支持多选文件

Returns

()

() : 

$this name(String $name) 上传的文件字段名

Returns

()

() : 

$this accept(String $accept) 接受上传的文件类型

Returns

()

() : 

$this maxSize(int $size) 文件大小限制,单位 kb

Returns

()

() : 

$this withCredentials(Boolean $bool) 支持发送 cookie 凭证信息, 默认为false

Returns

()

() : 

$this maxLength(Int $length) 最大上传文件数, 0为无限

Returns

init()

init() 

组件初始化

setRequired()

setRequired(null  $message = '',   $trigger = 'change',   $type = null) : $this

设置组件的值为必填

Parameters

null $message
$trigger
$type

Returns

$this