1. 程式人生 > >elementUI中el-upload元件的經驗

elementUI中el-upload元件的經驗

使用: 

this.$refs.uploada.uploadFiles 
來獲取已選擇的檔案數

```

<el-form :model="ruleForm"
         ref="ruleForm"> <el-form-item label="上傳檔案"> <el-upload ref="uploada" :action="mixinUploadUrl" :file-list="fileList"> <el-button size="small" type="primary">點選上傳</el-button> </el-upload> </el-form-item> <el-form-item> <el-button type="primary" @click="submitForm('ruleForm')">匯出</el-button> </el-form-item> </el-form> <script> export default { data () { return { fileList: [], } }, methods: { submitForm (formName) { //包含上傳的檔案資訊和服務端返回的所有資訊都在這個物件裡 this.$refs.uploada.uploadFiles }, } } </script>
```