add 文件上传

This commit is contained in:
lb
2023-02-02 14:45:40 +08:00
parent 6063f40606
commit cb3e47a45e
4 changed files with 70 additions and 5 deletions

View File

@@ -0,0 +1,39 @@
export default {
name: 'UploadComponent',
props: {
existingFiles: {
type: Array,
default: () => [ /** { }, { }, ... */]
},
typeCode: {
type: String,
default: '' // 文件类型编码
},
bind: { // element-ui 的 props
type: Object,
default: () => ({})
}
},
data() {
return {
}
},
computed: {
fileList: {
set(list) { },
get() {
// TODO计划要根据 existingFiles 来过滤
return []
}
}
},
methods: {
},
render: function (h) {
return h('el-upload', { props: { action: this.bind.action ?? '#', 'file-list': this.fileList } }, [
h('el-button', { props: { size: 'small', type: 'primary' } }, '选择文件'),
h('div', { slot: 'tip', 'class': 'el-upload__tip' }, '只能上传jpg/png文件且不超过500kb')
])
}
}