CRMEB v4 后臺表單說明

2022-04-11 11:28 更新

form-buider 說明

參考

ui框架:iview2.x

js表單生成器生成:form-create

github :?https://github.com/xaboy/form-builder

參考文檔:?http://www.form-create.com

添加產(chǎn)品表單

$field = [
    Form::select('cate_id','產(chǎn)品分類')->setOptions(function(){
        $list = CategoryModel::getTierList();
        foreach ($list as $menu){
            $menus[] = ['value'=>$menu['id'],'label'=>$menu['html'].$menu['cate_name'],'disabled'=>$menu['pid']== 0];//,'disabled'=>$menu['pid']== 0];
        }
        return $menus;
    })->filterable(1)->multiple(1),
    Form::input('store_name','產(chǎn)品名稱')->col(Form::col(8)),
    Form::input('store_info','產(chǎn)品簡介')->type('textarea'),
    Form::input('keyword','產(chǎn)品關(guān)鍵字')->placeholder('多個用英文狀態(tài)下的逗號隔開'),
    Form::input('unit_name','產(chǎn)品單位','件'),
    Form::frameImageOne('image','產(chǎn)品主圖片(305*305px)',Url::build('admin/widget.images/index',array('fodder'=>'image')))->icon('image')->width('100%')->height('550px'),
    Form::frameImages('slider_image','產(chǎn)品輪播圖(640*640px)',Url::build('admin/widget.images/index',array('fodder'=>'slider_image')))->maxLength(5)->icon('images')->width('100%')->height('550px')->spin(0),
    Form::number('price','產(chǎn)品售價')->min(0)->col(8),
    Form::number('ot_price','產(chǎn)品市場價')->min(0)->col(8),
    Form::number('give_integral','贈送積分')->min(0)->precision(0)->col(8),
    Form::number('postage','郵費')->min(0)->col(Form::col(8)),
    Form::number('sales','銷量')->min(0)->precision(0)->col(8),
    Form::number('ficti','虛擬銷量')->min(0)->precision(0)->col(8),
    Form::number('stock','庫存')->min(0)->precision(0)->col(8),
    Form::number('cost','產(chǎn)品成本價')->min(0)->col(8),
    Form::number('sort','排序')->col(8),
    Form::radio('is_show','產(chǎn)品狀態(tài)',0)->options([['label'=>'上架','value'=>1],['label'=>'下架','value'=>0]])->col(8),
    Form::radio('is_hot','熱賣單品',0)->options([['label'=>'是','value'=>1],['label'=>'否','value'=>0]])->col(8),
    Form::radio('is_benefit','促銷單品',0)->options([['label'=>'是','value'=>1],['label'=>'否','value'=>0]])->col(8),
    Form::radio('is_best','精品推薦',0)->options([['label'=>'是','value'=>1],['label'=>'否','value'=>0]])->col(8),
    Form::radio('is_new','首發(fā)新品',0)->options([['label'=>'是','value'=>1],['label'=>'否','value'=>0]])->col(8),
    Form::radio('is_postage','是否包郵',0)->options([['label'=>'是','value'=>1],['label'=>'否','value'=>0]])->col(8)
];
return $this->makePostForm('添加商品', $field, Url::buildUrl('save' ), 'POST');

編輯產(chǎn)品表單

$product = ProductModel::get($id);
$form = Form::create(Url::build('update',array('id'=>$id)),[
    Form::select('cate_id','產(chǎn)品分類',explode(',',$product->getData('cate_id')))->setOptions(function(){
        $list = CategoryModel::getTierList();
        foreach ($list as $menu){
            $menus[] = ['value'=>$menu['id'],'label'=>$menu['html'].$menu['cate_name'],'disabled'=>$menu['pid']== 0];//,'disabled'=>$menu['pid']== 0];
        }
        return $menus;
    })->filterable(1)->multiple(1),
    Form::input('store_name','產(chǎn)品名稱',$product->getData('store_name')),
    Form::input('store_info','產(chǎn)品簡介',$product->getData('store_info'))->type('textarea'),
    Form::input('keyword','產(chǎn)品關(guān)鍵字',$product->getData('keyword'))->placeholder('多個用英文狀態(tài)下的逗號隔開'),
    Form::input('unit_name','產(chǎn)品單位',$product->getData('unit_name')),
    Form::frameImageOne('image','產(chǎn)品主圖片(305*305px)',Url::build('admin/widget.images/index',array('fodder'=>'image')),$product->getData('image'))->icon('image')->width('100%')->height('550px'),
    Form::frameImages('slider_image','產(chǎn)品輪播圖(640*640px)',Url::build('admin/widget.images/index',array('fodder'=>'slider_image')),json_decode($product->getData('slider_image'),1))->maxLength(5)->icon('images'),
    Form::number('price','產(chǎn)品售價',$product->getData('price'))->min(0)->precision(2)->col(8),
    Form::number('ot_price','產(chǎn)品市場價',$product->getData('ot_price'))->min(0)->col(8),
    Form::number('give_integral','贈送積分',$product->getData('give_integral'))->min(0)->precision(0)->col(8),
    Form::number('postage','郵費',$product->getData('postage'))->min(0)->col(8),
    Form::number('sales','銷量',$product->getData('sales'))->min(0)->precision(0)->col(8),
    Form::number('ficti','虛擬銷量',$product->getData('ficti'))->min(0)->precision(0)->col(8),
    Form::number('stock','庫存',ProductModel::getStock($id)>0?ProductModel::getStock($id):$product->getData('stock'))->min(0)->precision(0)->col(8),
    Form::number('cost','產(chǎn)品成本價',$product->getData('cost'))->min(0)->col(8),
    Form::number('sort','排序',$product->getData('sort'))->col(8),
    Form::radio('is_show','產(chǎn)品狀態(tài)',$product->getData('is_show'))->options([['label'=>'上架','value'=>1],['label'=>'下架','value'=>0]])->col(8),
    Form::radio('is_hot','熱賣單品',$product->getData('is_hot'))->options([['label'=>'是','value'=>1],['label'=>'否','value'=>0]])->col(8),
    Form::radio('is_benefit','促銷單品',$product->getData('is_benefit'))->options([['label'=>'是','value'=>1],['label'=>'否','value'=>0]])->col(8),
    Form::radio('is_best','精品推薦',$product->getData('is_best'))->options([['label'=>'是','value'=>1],['label'=>'否','value'=>0]])->col(8),
    Form::radio('is_new','首發(fā)新品',$product->getData('is_new'))->options([['label'=>'是','value'=>1],['label'=>'否','value'=>0]])->col(8),
    Form::radio('is_postage','是否包郵',$product->getData('is_postage'))->options([['label'=>'是','value'=>1],['label'=>'否','value'=>0]])->col(8)
]);
return $this->makePostForm('編輯商品', $field, Url::buildUrl('edit' ), 'PUT');

AJAX請求返回

namespace \FormBuilder\Json

Json::succ(msg,data = [])表單提交成功

Json::fail(errorMsg,data = [])表單提交失敗

Json::uploadSucc(filePath,msg)文件/圖片上傳成功,上傳成功后返回文件地址

Json::uploadFail(errorMsg)文件/圖片上傳失敗

Form 表單生成類

namespace \FormBuilder\Form

components(array $components = [])批量添加組件

formRow(Row $row)設(shè)置表單Row規(guī)則

formStyle(FormStyle $formStyle)設(shè)置表單樣式

setAction($action)設(shè)置提交地址

getConfig($key=’’)設(shè)置配置文件

setMethod($method)設(shè)置提交方式

setMethod($method)設(shè)置提交方式

append(FormComponentDriver $component)追加組件

prepend(FormComponentDriver $component)開頭插入組件

getRules()獲得表單規(guī)則

view()獲取表單視圖

script()獲取表單生成器所需全部js

formScript()獲取生成表單的js代碼,可用js變量接受生成函數(shù)create,執(zhí)行create(el,callback)即可生成表單

getScript()獲取表單生成器所需js

create($action, array $components = [])生成表單快捷方法

setTitle($title)設(shè)置title

FormStyle表單樣式

Form::style

 * @method $this inline(Boolean $bool) 是否開啟行內(nèi)表單模式
 * @method $this labelPosition(String $labelPosition) 表單域標(biāo)簽的位置,可選值為 left、right、top
 * @method $this labelWidth(Number $labelWidth) 表單域標(biāo)簽的寬度,所有的 FormItem 都會繼承 Form 組件的 label-width 的值
 * @method $this showMessage(Boolean $bool) 是否顯示校驗錯誤信息
 * @method $this autocomplete($bool = false) 原生的 autocomplete 屬性,可選值為 true = off 或 false = on

Row柵格規(guī)則

Form::row

 * @method $this gutter(Number $gutter) 柵格間距,單位 px,左右平分
 * @method $this type(String $type) 柵格的順序,在flex布局模式下有效
 * @method $this align(String $align) flex 布局下的垂直對齊方式,可選值為top、middle、bottom
 * @method $this justify(String $justify) flex 布局下的水平排列方式,可選值為start、end、center、space-around、space-between
 * @method $this className(String $className) 自定義的class名稱

參考:view row柵格布局

Col柵格規(guī)則

Form::col

 * @method $this span(Number $span) 柵格的占位格數(shù),可選值為0~24的整數(shù),為 0 時,相當(dāng)于display:none
 * @method $this order(Number $order) 柵格的順序,在flex布局模式下有效
 * @method $this offset(Number $offset) 柵格左側(cè)的間隔格數(shù),間隔內(nèi)不可以有柵格
 * @method $this push(Number $push) 柵格向右移動格數(shù)
 * @method $this pull(Number $pull) 柵格向左移動格數(shù)
 * @method $this labelWidth(Number $labelWidth) 表單域標(biāo)簽的的寬度,默認(rèn)150px
 * @method $this className(String $className) 自定義的class名稱
 * @method $this xs(Number|Col $span) <768px 響應(yīng)式柵格,可為柵格數(shù)或一個包含其他屬性的對象
 * @method $this sm(Number|Col $span) ≥768px 響應(yīng)式柵格,可為柵格數(shù)或一個包含其他屬性的對象
 * @method $this md(Number|Col $span) ≥992px 響應(yīng)式柵格,可為柵格數(shù)或一個包含其他屬性的對象
 * @method $this lg(Number|Col $span) ≥1200px 響應(yīng)式柵格,可為柵格數(shù)或一個包含其他屬性的對象

參考:view col柵格布局

select,checkbox,radio組件配置options專用方法

option($value, $label, $disabled = false)單獨設(shè)置選項

options(array $options, $disabled = false)批量設(shè)置選項

setOptions($options, $disabled = false)批量設(shè)置選項 支持匿名函數(shù)

以下組件公共方法

col($span)配置col柵格規(guī)則,傳入0-24的數(shù)字或Col類,默認(rèn)為24

value($value)設(shè)置組件的值

validateAs(array $validate)添加驗證規(guī)則

validate()設(shè)置驗證規(guī)則規(guī)則說明

組件

namespace \FormBuilder\Form

多級聯(lián)動組件

Form::cascader多級聯(lián)動組件,value為array類型

Form::city省市二級聯(lián)動,value為array類型

Form::cityArea省市區(qū)三級聯(lián)動,value為array類型

    方法   返回值 方法名(參數(shù))   注釋
 * @method $this type(String $type) 數(shù)據(jù)類型, 支持 city_area(省市區(qū)三級聯(lián)動), city (省市二級聯(lián)動), other (自定義)
 * @method $this disabled(Boolean $bool) 是否禁用選擇器
 * @method $this clearable(Boolean $bool) 是否支持清除
 * @method $this placeholder(String $placeholder) 占位文本
 * @method $this trigger(String $trigger) 次級菜單展開方式,可選值為 click 或 hover
 * @method $this changeOnSelect(Boolean $bool) 當(dāng)此項為 true 時,點選每級菜單選項值都會發(fā)生變化, 默認(rèn)為 false
 * @method $this size(String $size) 輸入框大小,可選值為large和small或者不填
 * @method $this filterable(Boolean $bool) 是否支持搜索
 * @method $this notFoundText(String $text) 當(dāng)搜索列表為空時顯示的內(nèi)容
 * @method $this transfer(Boolean $bool) /是否將彈層放置于 body 內(nèi),在 Tabs、帶有 fixed 的 Table 列內(nèi)使用時,建議添加此屬性,它將不受父級樣式影響,從而達(dá)到更好的效果
 * @method $this required($message = null, $trigger = 'change') 設(shè)為必選
 * @method $this data(array $data) 設(shè)置多級聯(lián)動可選項的數(shù)據(jù)
 *  例如: {
 *    "value":"北京市", "label":"北京市", "children":[{
 *        "value":"東城區(qū)", "label":"東城區(qū)"
 *    }]
 *  }
 * @method $this jsData($var) 設(shè)置data為js變量
 * @method string getType($var) 獲取組件類型

復(fù)選框組件

Form::checkbox

 * @method $this size(String $size) 多選框組的尺寸,可選值為 large、small、default 或者不設(shè)置
 * @method $this required($message = null, $trigger = 'change') 設(shè)為必選

顏色選擇組件

Form::color

 * @method $this disabled(Boolean $bool) 是否禁用
 * @method $this alpha(Boolean $bool) 是否支持透明度選擇, 默認(rèn)為false
 * @method $this hue(Boolean $bool) 是否支持色彩選擇, 默認(rèn)為true
 * @method $this recommend(Boolean $bool) 是否顯示推薦的顏色預(yù)設(shè), 默認(rèn)為false
 * @method $this size(String $size) 尺寸,可選值為large、small、default或者不設(shè)置
 * @method $this format(String $format) 顏色的格式,可選值為 hsl、hsv、hex、rgb    String    開啟 alpha 時為 rgb,其它為 hex
 * @method $this required($message = null, $trigger = 'change') 設(shè)為必選
 * @method $this colors($colors) 自定義顏色預(yù)設(shè)

日期選擇組件

Form::date日期選擇

Form::dateRange日期區(qū)間選擇,value為array類型

Form::dateTime日期+時間選擇

Form::dateTimeRange日期+時間 區(qū)間選擇,value為array類型

Form::year年份選擇

Form::month月份選擇

 * @method $this type(String $type) 顯示類型,可選值為 date、daterange、datetime、datetimerange、year、month
 * @method $this format(String $format) 展示的日期格式, 默認(rèn)為yyyy-MM-dd HH:mm:ss
 * @method $this placement(String $placement) 日期選擇器出現(xiàn)的位置,可選值為top, top-start, top-end, bottom, bottom-start, bottom-end, left, left-start, left-end, right, right-start, right-end, 默認(rèn)為bottom-start
 * @method $this placeholder(String $placeholder) 占位文本
 * @method $this confirm(Boolean $bool) 是否顯示底部控制欄,開啟后,選擇完日期,選擇器不會主動關(guān)閉,需用戶確認(rèn)后才可關(guān)閉, 默認(rèn)為false
 * @method $this size(String $size) 尺寸,可選值為large、small、default或者不設(shè)置
 * @method $this disabled(Boolean $bool) 是否禁用選擇器
 * @method $this clearable(Boolean $bool) 是否顯示清除按鈕
 * @method $this readonly(Boolean $bool) 完全只讀,開啟后不會彈出選擇器,只在沒有設(shè)置 open 屬性下生效
 * @method $this editable(Boolean $bool) 文本框是否可以輸入, 默認(rèn)為false
 * @method $this transfer(Boolean $bool) 是否將彈層放置于 body 內(nèi),在 Tabs、帶有 fixed 的 Table 列內(nèi)使用時,建議添加此屬性,它將不受父級樣式影響,從而達(dá)到更好的效果, 默認(rèn)為false
 * @method $this splitPanels(Boolean $bool) 開啟后,左右面板不聯(lián)動,僅在 daterange 和 datetimerange 下可用。
 * @method $this showWeekNumbers(Boolean $bool) 開啟后,可以顯示星期數(shù)。

frame組件

Form::frameframe組件

Form::frameInputsframe組件,input類型,value為array類型

Form::frameFilesframe組件,file類型,value為array類型

Form::frameImagesframe組件,image類型,value為array類型

Form::frameInputOneframe組件,input類型,value為string|number類型

Form::frameFileOneframe組件,file類型,value為string|number類型

Form::frameImageOneframe組件,image類型,value為string|number類型

* @method $this type(String $type) frame類型, 有input, file, image, 默認(rèn)為input
 * @method $this src(String $src) iframe地址
 * @method $this maxLength(int $length) value的最大數(shù)量, 默認(rèn)無限制
 * @method $this icon(String $icon) 打開彈出框的按鈕圖標(biāo)
 * @method $this height(String $height) 彈出框高度
 * @method $this width(String $width) 彈出框?qū)挾? * @method $this spin(Boolean $bool) 是否顯示加載動畫, 默認(rèn)為 true
 * @method $this frameTitle(String $title) 彈出框標(biāo)題
 * @method $this handleIcon(Boolean $bool) 操作按鈕的圖標(biāo), 設(shè)置為false將不顯示, 設(shè)置為true為默認(rèn)的預(yù)覽圖標(biāo), 類型為file時默認(rèn)為false, image類型默認(rèn)為true
 * @method $this allowRemove(Boolean $bool) 是否可刪除, 設(shè)置為false是不顯示刪除按鈕

hidden組件

Form::hiddenhidden組件

數(shù)字輸入框組件

Form::number

 * @method $this max(float $max) 最大值
 * @method $this min(float $min) 最小值
 * @method $this step(float $step) 每次改變的步伐,可以是小數(shù)
 * @method $this size(String $size) 輸入框尺寸,可選值為large、small、default或者不填
 * @method $this disabled(Boolean $bool) 設(shè)置禁用狀態(tài),默認(rèn)為false
 * @method $this placeholder(String $placeholder) 占位文本
 * @method $this readonly(Boolean $bool) 是否設(shè)置為只讀,默認(rèn)為false
 * @method $this editable(Boolean $bool) 是否可編輯,默認(rèn)為true
 * @method $this precision(int $precision) 數(shù)值精度

input輸入框組件

Form::inputinput輸入框

其他 type:
text類型 Form::text,
password類型Form::password,
textarea類型Form::textarea,
url類型Form::url,
email類型Form::email,
date類型Form::idate

 * @method $this type(String $type) 輸入框類型,可選值為 text、password、textarea、url、email、date;
 * @method $this size(String $size) 輸入框尺寸,可選值為large、small、default或者不設(shè)置;
 * @method $this placeholder(String $placeholder) 占位文本
 * @method $this clearable(Boolean $bool) 是否顯示清空按鈕, 默認(rèn)為false
 * @method $this disabled(Boolean $bool) 設(shè)置輸入框為禁用狀態(tài), 默認(rèn)為false
 * @method $this readonly(Boolean $bool) 設(shè)置輸入框為只讀, 默認(rèn)為false
 * @method $this maxlength(int $length) 最大輸入長度
 * @method $this icon(String $icon) 輸入框尾部圖標(biāo),僅在 text 類型下有效
 * @method $this rows(int $rows) 文本域默認(rèn)行數(shù),僅在 textarea 類型下有效, 默認(rèn)為2
 * @method $this number(Boolean $bool) 將用戶的輸入轉(zhuǎn)換為 Number 類型, 默認(rèn)為false
 * @method $this autofocus(Boolean $bool) 自動獲取焦點, 默認(rèn)為false
 * @method $this autocomplete(Boolean $bool) 原生的自動完成功能, 默認(rèn)為false
 * @method $this spellcheck(Boolean $bool) 原生的 spellcheck 屬性, 默認(rèn)為false
 * @method $this wrap(String $warp) 原生的 wrap 屬性,可選值為 hard 和 soft, 默認(rèn)為soft
 * @method $this autoSize($minRows, $maxRows) 自適應(yīng)內(nèi)容高度,僅在 textarea 類型下有效

單選框組件

Form::radio

 * @method $this size(String $size) 單選框的尺寸,可選值為 large、small、default 或者不設(shè)置
 * @method $this vertical(Boolean $bool) 是否垂直排列,按鈕樣式下無效
 * @method $this button() 使用按鈕樣式
 * @method $this required($message = null, $trigger = 'change') 設(shè)為必選

評分組件

Form::rate

 * @method $this count(int $star) star 總數(shù), 默認(rèn)為 5
 * @method $this allowHalf(Boolean $bool) 是否允許半選, 默認(rèn)為 false
 * @method $this disabled(Boolean $bool) 是否只讀,無法進(jìn)行交互, 默認(rèn)為
 * @method $this showText(Boolean $bool) 是否顯示提示文字, 默認(rèn)為 false
 * @method $this clearable(Boolean $bool) 是否可以取消選擇, 默認(rèn)為 false

select選擇框組件

Form::select選擇框

Form::selectMultipleselect選擇框,多選,value為array類型

Form::selectOneselect選擇框,單選

* @method $this multiple(Boolean $bool) 是否支持多選, 默認(rèn)為false
 * @method $this disabled(Boolean $bool) 是否禁用, 默認(rèn)為false
 * @method $this clearable(Boolean $bool) 是否可以清空選項,只在單選時有效, 默認(rèn)為false
 * @method $this filterable(Boolean $bool) 是否支持搜索, 默認(rèn)為false
 * @method $this size(String $size) 選擇框大小,可選值為large、small、default或者不填
 * @method $this placeholder(String $placeholder) 占位文本
 * @method $this transfer(String $transfer) 是否將彈層放置于 body 內(nèi),在 Tabs、帶有 fixed 的 Table 列內(nèi)使用時,建議添加此屬性,它將不受父級樣式影響,從而達(dá)到更好的效果, 默認(rèn)為false
 * @method $this placement(String $placement) 彈窗的展開方向,可選值為 bottom 和 top, 默認(rèn)為bottom
 * @method $this notFoundText(String $text) 當(dāng)下拉列表為空時顯示的內(nèi)容, 默認(rèn)為 無匹配數(shù)據(jù)
 * @method $this required($message = null, $trigger = 'change') 設(shè)為必選

滑塊組件

Form::slider滑塊組件

Form::sliderRange滑塊組件,區(qū)間選擇,

 * @method $this min(float $min) 最小值, 默認(rèn) 0
 * @method $this max(float $max) 最大值, 默認(rèn) 100
 * @method $this step(float $step) 步長,取值建議能被(max - min)整除, 默認(rèn) 1
 * @method $this disabled(Boolean $bool) 是否禁用滑塊, 默認(rèn) false
 * @method $this range(Boolean $bool) 是否開啟雙滑塊模式, 默認(rèn)
 * @method $this showInput(Boolean $bool) 是否顯示數(shù)字輸入框,僅在單滑塊模式下有效, 默認(rèn) false
 * @method $this showStops(Boolean $bool) 是否顯示間斷點,建議在 step 不密集時使用, 默認(rèn) false
 * @method $this showTip(String $tip) 提示的顯示控制,可選值為 hover(懸停,默認(rèn))、always(總是可見)、never(不可見)
 * @method $this inputSize(String $size) 數(shù)字輸入框的尺寸,可選值為large、small、default或者不填,僅在開啟 show-input 時有效

開關(guān)組件組件

Form::switches

 * @method $this size(String $size) 開關(guān)的尺寸,可選值為large、small、default或者不寫。建議開關(guān)如果使用了2個漢字的文字,使用 large。
 * @method $this disabled(Boolean $bool) 禁用開關(guān), 默認(rèn)為false
 * @method $this trueValue(String $value) 選中時的值,默認(rèn)為1
 * @method $this falseValue(String $value) 沒有選中時的值,默認(rèn)為0
 * @method $this openStr(String $open) 自定義顯示打開時的內(nèi)容
 * @method $this closeStr(String $close) 自定義顯示關(guān)閉時的內(nèi)容

時間選擇組件

Form::timePicker時間選擇組件

Form::time時間選擇

Form::timeRange時間區(qū)間選擇,value為array類型

* @method $this type(String $type) 顯示類型,可選值為 time、timerange
 * @method $this format(String $format) 展示的時間格式, 默認(rèn)為HH:mm:ss
 * @method $this placement(String $placement) 時間選擇器出現(xiàn)的位置,可選值為top, top-start, top-end, bottom, bottom-start, bottom-end, left, left-start, left-end, right, right-start, right-end, 默認(rèn)為bottom-start
 * @method $this placeholder(String $placeholder) 占位文本
 * @method $this confirm(Boolean $bool) 是否顯示底部控制欄, 默認(rèn)為false
 * @method $this size(String $size) 尺寸,可選值為large、small、default或者不設(shè)置
 * @method $this disabled(Boolean $bool) 是否禁用選擇器
 * @method $this clearable(Boolean $bool) 是否顯示清除按鈕
 * @method $this readonly(Boolean $bool) 完全只讀,開啟后不會彈出選擇器,只在沒有設(shè)置 open 屬性下生效
 * @method $this editable(Boolean $bool) 文本框是否可以輸入, 默認(rèn)為false
 * @method $this transfer(Boolean $bool) 是否將彈層放置于 body 內(nèi),在 Tabs、帶有 fixed 的 Table 列內(nèi)使用時,建議添加此屬性,它將不受父級樣式影響,從而達(dá)到更好的效果, 默認(rèn)為false
 * @method $this steps($h, $i = 0, $s = 0) 下拉列表的時間間隔,數(shù)組的三項分別對應(yīng)小時、分鐘、秒, 例如設(shè)置為 [1, 15] 時,分鐘會顯示:00、15、30、45。

上傳組件

Form::upload上傳組件

Form::uploadImages多圖上傳組件,value為array類型

Form::uploadFiles多文件上傳組件,value為array類型

Form::uploadImageOne單圖上傳組件

Form::uploadFileOne單文件上傳組件

 * @method $this uploadType(String $uploadType) 上傳文件類型,可選值為 image(圖片上傳),file(文件上傳)
 * @method $this action(String $action) 上傳的地址
 * @method $this multiple(Boolean $bool) 是否支持多選文件
 * @method $this name(String $name) 上傳的文件字段名
 * @method $this accept(String $accept) 接受上傳的文件類型
 * @method $this maxSize(int $size) 文件大小限制,單位 kb
 * @method $this withCredentials(Boolean $bool) 支持發(fā)送 cookie 憑證信息, 默認(rèn)為false
 * @method $this maxLength(Int $length) 最大上傳文件數(shù), 0為無限
 * @method $this headers(array $headers) 設(shè)置上傳的請求頭部
 * @method $this format(array $format) 支持的文件類型,與 accept 不同的是,format 是識別文件的后綴名,accept 為 input 標(biāo)簽原生的 accept 屬性,會在選擇文件時過濾,可以兩者結(jié)合使用
 * @method $this data(array $data) 上傳時附帶的額外參數(shù)
 * @method $this required($message = null, $trigger = 'change') 設(shè)為必選

樹型組件

Form::tree樹型組件

Form::treeSelected選中類型,value為array類型,當(dāng)type=selected并且multiple=false,值為String或Number類型

Form::treeChecked選擇類型,value為array類型

* @method $this type(String $type) 類型,可選值為 checked、selected
 * @method $this multiple(Boolean $bool) 是否支持多選,當(dāng)`type=selected`并且`multiple=false`,默認(rèn)為false,值為String或Number類型,其他情況為Array類型
 * @method $this showCheckbox(Boolean $bool) 是否顯示多選框,默認(rèn)為false
 * @method $this emptyText(String $emptyText) 沒有數(shù)據(jù)時的提示,默認(rèn)為'暫無數(shù)據(jù)'
 * @method $this data(array $treeData) 設(shè)置可選的data,**id必須唯一**
 * @method $this jsData($var) 設(shè)置data為js變量

樹型組件data數(shù)據(jù)類 TreeData

Form::treeData樹型組件data

 * @method $this id(String $id) Id,必須唯一
 * @method $this title(String $title) 標(biāo)題
 * @method $this expand(Boolean $bool) 是否展開直子節(jié)點,默認(rèn)為false
 * @method $this disabled(Boolean $bool) 禁掉響應(yīng),默認(rèn)為false
 * @method $this disableCheckbox(Boolean $bool) 禁掉 checkbox
 * @method $this selected(Boolean $bool) 是否選中子節(jié)點
 * @method $this checked(Boolean $bool) 是否勾選(如果勾選,子節(jié)點也會全部勾選)
 * @method $this children(array $children) 批量設(shè)置子集
 * @method $this child(TreeData $child) 設(shè)置子集

所有組件生成效果

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號