add 文件上传
This commit is contained in:
39
src/components/noTemplateComponents/uploadComponent.js
Normal file
39
src/components/noTemplateComponents/uploadComponent.js
Normal 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')
|
||||
])
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user