# 全局的組件如何使用
~~~
<wl-dir-upload
:dirCheckFun="dirCheckFun"
tableMaxHeight="600"
:fileNameCheckFun="dirNameFun"
uploadType="hadoop"
:format="formatData"
@upAllImgOver="upAllImgOverAction"
uploadUrl="http://120.27.63.37:38081/api/ac/file/fileCommonService/upLoadFiles"
></wl-dir-upload>
~~~
### wlUploadFiles props
| 屬性 | 說明 | 類型 | 默認值 |
| --- | --- | --- | --- |
| rootDir | 上傳文件的根路徑 | String | /dangan/ |
| maxSize | 圖片最大限制 | Number| 2048 |
| format| 上傳類型 | Array| ['jpg', 'jpeg', 'png'] |
| uploadUrl| 上傳的地址>=0.3.5 | String| http://house.wanglanglang.com |
| getSignUrl| hadoop的獲取簽名地址 | String|/api/ac/dangan/getHadoopService/getSign |
| uploadType| 上傳的方式 | String| 默認:oss,有:oss,php,hadoop
| dirCheckFun| 對文件夾命名規則進行校驗 | Function|
| fileNameCheckFun| 對文件命名規則進行校驗 | Function|
### Upload methods
| 方法名 | 說明 | 參數 |
| --- | --- | --- |
| clear | 清空已上傳的文件列表(清空的時候也需要把默認顯示的內容清空)>=0.3.6 | 無 |
> 增加v-model 雙向綁定,直接返回上傳的字符串,如果是多個圖片或者文件用“,“分隔開
> 如果用hadoop上傳方式必須傳遞uploadUrl 上傳的地址,上傳的參數必須是
```
[TOC]
{
"filePath":"aaaa",
"fileName":"紅海灘景區智慧旅游20150423(云瑞).docx",
"file":"/9j/4S/....
}
```
> 返回的數據格式必須是如下:
```
{errcode: "0",data:'....png',errmsg:'success'}
```
>dirCheckFun 函數說明
~~~
dirCheckFun (dirArr) {
if (dirArr.length <= 2) {
// return { errcode: 1001, errmsg: '請刪除此文件' }
}
return { errcode: 0, errmsg: '沒有問題' }
},
~~~
>fileNameCheckFun 函數說明
~~~
dirNameFun (dirArr, name) {
let arr2 = name.split('-')
if (arr2.length !== 4) {
return { errcode: 1001, errmsg: '文件名稱必須包含三個-' }
}
return { errcode: 0, errmsg: '沒有問題' }
}
~~~
> return { errcode: 1001,errmsg:'文件名不對', selfShow: true }
> 如果errcode 是false 就不上傳文件提示errmsg的錯誤信息,如果selfShow傳遞true 不提示信息,自己寫提示代碼
*****
1. 修改成每次上傳一個文件,成功后在上傳第二次文件,如果失敗了,等所有的圖片都輪訓一邊后,可以再次點擊批量上傳,然后會從失敗的地方繼續上傳。2020-4-21 制
- vue學習方向
- iview-admin項目說明
- 快速開始
- 開發工具
- 開始開發
- 接口的定義和調用
- 常用函數匯總
- 組件的定義
- iview開發規范說明
- 插件使用說明
- 時間插件
- 命名規范
- vue變量函數規則
- 接口嵌套使用說明
- 組件建立說明
- vue使用規范
- 數據檢測特別說名
- iview-layout-themes
- util
- common
- xeUtils詳細說明
- form表單自動生成
- theme1使用說明
- theme2使用說明
- hd-login登錄組件說明
- wl-upload-files圖片上傳組件
- wl-upload-imgs
- wl-upload-oss-files
- wl-read-excel
- wl-dir-upload選擇文件架
- system組件說明
- 機構管理wl-company-manager
- 用戶管理
- wl-excel-import Excel數據導入
- 前臺使用說明
- 后臺使用說明
- Excel使用說明
- wl-vue2-editor
- 字符串截取方法
- redis常用說明
- 推薦redis使用規范