1

Vue Formulate 上 excel 文件的 MIME 类型是什么

我试过了

<FormulateInput
      type="image"
      name="headshot"
      label="Select an image to upload"
      :uploader="uploadFile"
      help="Select a png, jpg or gif to upload."
      validation="mime:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
    />

但这似乎不起作用。如何验证所选文件是否确实是 a .xlsor .xlsxfile .?

4

1 回答 1

0

vue 制定的默认 mime 列表非常小。但是扩展列表非常容易:

import Vue from 'vue'
import VueFormulate from '@braid/vue-formulate'

Vue.use(VueFormulate, {
  mimes: {
    xls: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
    // ... any other mimes
  }
})

这里有相关文档:https ://vueformulate.com/guide/inputs/types/file/#mime-types

完全披露:我是 Vue Formulate 的作者。

于 2020-12-07T14:56:22.843 回答