## 全局配置
### 該文檔不再維護,新版文檔地址: [form-create 文檔](http://fc.gd8.top)
全局配置由一下7個部分組成
1. `el` 表單插入的節點,
2. `form` 表單整體布局配置
3. `row` 表單組件布局配置 [參考iview柵格布局](https://www.iviewui.com/components/grid)
4. `upload` upload組件全局配置
5. `submitBtn` 提交按鈕樣式配置
6. `resetBtn` 重置按鈕樣式配置
7. `onSubmit` **表單提交事件**
#### 完整配置
```javascript
{
//插入節點,默認document.body
el:null,
//form配置
form:{
//是否開啟行內表單模式
inline:false,
//表單域標簽的位置,可選值為 left、right、top
labelPosition:'right',
//表單域標簽的寬度,所有的 FormItem 都會繼承 Form 組件的 label-width 的值
labelWidth:125,
//是否顯示校驗錯誤信息
showMessage:true,
//原生的 autocomplete 屬性,可選值為 off 或 on
autocomplete:'off',
},
//row布局配置
row:{
//柵格間距,單位 px,左右平分
gutter:0,
//布局模式,可選值為flex或不選,在現代瀏覽器下有效
type:undefined,
//flex 布局下的垂直對齊方式,可選值為top、middle、bottom
align:undefined,
//flex 布局下的水平排列方式,可選值為start、end、center、space-around、space-between
justify:undefined,
//自定義的class名稱
className:undefined
},
//上傳組件全局配置
upload:{
//上傳文件之前的鉤子,參數為上傳的文件,若返回 false 或者 Promise 則停止上傳
beforeUpload:()=>{},
//文件上傳時的鉤子,返回字段為 event, file, fileList
onProgress:(event, file, fileList)=>{},
//文件上傳成功時的鉤子,返回字段為 response, file, fileList,若需有把文件添加到文件列表中,在函數值返回即可
onSuccess:(response, file, fileList)=>{
// return 'filePath';
},
//文件上傳失敗時的鉤子,返回字段為 error, file, fileList
onError:(error, file, fileList)=>{},
//點擊已上傳的文件鏈接時的鉤子,返回字段為 file, 可以通過 file.response 拿到服務端返回數據
onPreview:(file)=>{},
//文件列表移除文件時的鉤子,返回字段為 file, fileList
onRemove:(file, fileList)=>{},
//文件格式驗證失敗時的鉤子,返回字段為 file, fileList
onFormatError:(file, fileList)=>{},
//文件超出指定大小限制時的鉤子,返回字段為 file, fileList
onExceededSize:(file, fileList)=>{},
//輔助操作按鈕的圖標 ,設置為false將不顯示
handleIcon:'ios-eye-outline',
//點擊輔助操作按鈕事件
onHandle:(src)=>{},
//是否可刪除,設置為false是不顯示刪除按鈕
allowRemove:true,
},
//表單創建成功后回調函數
mounted:()=>{},
//表單提交事件
onSubmit:(formData)=>{},
//提交按鈕配置,設置submitBtn=false或submitBtn.show=false時不顯示按鈕
submitBtn:{
//按鈕類型,可選值為primary、ghost、dashed、text、info、success、warning、error或者不設置
type:"primary",
//按鈕大小,可選值為large、small、default或者不設置
size:"large",
//按鈕形狀,可選值為circle或者不設置
shape:undefined,
//開啟后,按鈕的長度為 100%
long:true,
//設置button原生的type,可選值為button、submit、reset
htmlType:"button",
//設置按鈕為禁用狀態
disabled:false,
//設置按鈕的圖標類型
icon:"ios-upload",
//按鈕文字提示
innerText:"提交",
//設置按鈕為加載中狀態
loading:false,
//默認顯示
show:true
},
//重置按鈕默認配置,設置resetBtn=true或resetBtn.show=true時顯示
resetBtn:{
type:"ghost",
size:"large",
shape:undefined,
long:true,
htmlType:"button",
disabled:false,
icon:"refresh",
innerText:"重置",
loading:false,
//默認不顯示
show:false
}
}
```
---