使用element-ui中的el-upload组件时携带其他参数


  上传PDF
pdfData: {
    '参数1': '',
    '参数2': '',
    '参数3': ''
  },
  headers: {
    Authorization: Cookies.get('token') 
    //从cookie里获取token,并赋值 Authorization ,而不是token
  }
// 上传前的回调函数
  handleBefore(file) {
    const _vm = this;
    _vm.pdfData.参数1 = '值1';    
    _vm.pdfData.参数2 = '值2';    
    _vm.pdfData.参数3 = '值3';    
  }
// 上传成功回调
  handleSuccess(res) {
    const _vm = this;
    if (res.status == 200) {
      _vm.$message({
        message: 'Success!',
        type: 'success'
      })
    } else {
      _vm.$message({
        message: 'Upload Error!',
        type: 'error'
      })
    }
  }

 

你可能感兴趣的:(前端,Vue,前端)