elementUI中el-upload组件的经验

使用: 

this.$refs..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>
```

posted on 2018-12-06 13:29  Eggsblue  阅读(4435)  评论(2编辑  收藏  举报

导航