Element.io文件上传类型在Windows系统中不起作用

时间:2019-01-10 09:39:22

标签: vue.js element

<el-upload class="avatar-uploader" action="https://jsonplaceholder.typicode.com/posts/" :show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
  <img v-if="imageUrl" :src="imageUrl" class="avatar">
  <el-button size="small" type="primary">Click to upload</el-button>
</el-upload>

 beforeAvatarUpload(file) {

        const isFile = file.type === 'application/msword';
        const isLt2M = file.size / 1024 / 1024 < 2;

        if (!isFile) {
          this.$message.error('File must be doc format!');
        }
        if (!isLt2M) {
          this.$message.error('filesize can not exceed 2MB!');
        }
        return isFile && isLt2M;
      }

我正在尝试对文档进行验证,但似乎无法在窗口中正常工作,请对此问题提出建议

它提供type =“”,但在Linux中确实可以正常工作

0 个答案:

没有答案