forked from mt-fe-group/mt-yd-ui
update 上传组件
This commit is contained in:
parent
00343fa5b9
commit
302d1832df
@ -1,9 +1,50 @@
|
||||
<template>
|
||||
<div class="base-upload"></div>
|
||||
<div class="base-upload" style="border-radius: 8px; margin-top: 38px; padding: 0; max-height: 500px;">
|
||||
<el-upload class="yd-upload" :action="$http.adornUrl(url)" multiple name="files" :file-list="fileList" :on-remove="handleRemove" :before-remove="beforeRemove">
|
||||
<el-button size="small" type="primary">{{ buttonContent }}</el-button>
|
||||
<div v-if="tip" slot="tip" class="el-upload__tip">{{ tip }}</div>
|
||||
</el-upload>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
name: 'BaseUpload',
|
||||
props: {
|
||||
url: String,
|
||||
buttonContent: String,
|
||||
tip: {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fileList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
beforeRemove(file, filelist) {
|
||||
return this.$confirm(`确定移除 ${file.name}?`)
|
||||
},
|
||||
handleRemove(file, filelist) {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.base-upload >>> .yd-upload {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.base-upload >>> .el-upload--text {
|
||||
width: 100px;
|
||||
position: relative;
|
||||
left: -72px;
|
||||
}
|
||||
|
||||
.base-upload >>> .el-upload__tip {
|
||||
margin-top: 0;
|
||||
margin-left: 5px;
|
||||
}
|
||||
</style>
|
||||
|
@ -83,8 +83,11 @@ const addOrUpdateConfigs = {
|
||||
{
|
||||
name: 'file-upload-key',
|
||||
label: '上传资料',
|
||||
component: null,
|
||||
component: () => import('@/components/base-upload'),
|
||||
props: { // 上传组件需要的 props
|
||||
url: "/monitoring/attachment/uploadFileFormData?typeCode=EquipmentTypeFile",
|
||||
buttonContent: '点击上传',
|
||||
tip: '上传文件大小不要超过 2mb (2048kb)'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user