np-form 文件上传

通过设置 type: 'upload' 可在表单中使用文件上传组件,底层使用 np-upload 封装。

v-model 绑定值为 string[] 类型,默认每项为 {name, url, type} 的 JSON 字符串。当 listTypeimage-cardurlOnlytrue 时,每项仅保存文件的 url 字符串。

浏览器不支持,请手动复制 upload.vue

组件配置

FormColumn Props

属性说明类型默认值
type设置为 'upload'string-
propsNUpload 属性,会透传给 n-uploadNUpload Propsopen in new window-
urlOnly仅在 listType: 'image-card' 时生效,值简化为 url 字符串数组booleanfalse
defaultValue默认文件列表string[]-
onChange文件列表改变事件(value: string[], ctx) => void-