|
@@ -4,17 +4,23 @@
|
|
|
v-if="url"
|
|
|
ref="upload"
|
|
|
:action="url"
|
|
|
- list-type="picture-card"
|
|
|
+ :list-type="listType"
|
|
|
:file-list="fileList"
|
|
|
:limit="limit"
|
|
|
:on-exceed="outLimit"
|
|
|
:on-preview="handlePictureCardPreview"
|
|
|
:before-remove="handleRemove"
|
|
|
:on-success="onSuccess"
|
|
|
+ :show-file-list="showList"
|
|
|
+ :accept="accept"
|
|
|
>
|
|
|
- <template>
|
|
|
+ <el-button size="small" type="primary" v-if="isBtn">点击上传</el-button>
|
|
|
+ <template v-else>
|
|
|
<i class="el-icon-plus"></i>
|
|
|
</template>
|
|
|
+ <template #tip v-if="tip">
|
|
|
+ {{ tip }}
|
|
|
+ </template>
|
|
|
</el-upload>
|
|
|
<el-dialog :visible.sync="dialogVisible">
|
|
|
<img width="100%" :src="dialogImageUrl" alt="" />
|
|
@@ -31,6 +37,11 @@ export default {
|
|
|
limit: { type: Number },
|
|
|
data: { type: null },
|
|
|
type: { type: String },
|
|
|
+ isBtn: { type: Boolean, default: false },
|
|
|
+ showList: { type: Boolean, default: true },
|
|
|
+ accept: { type: String },
|
|
|
+ tip: { type: String, default: undefined },
|
|
|
+ listType: { type: String, default: 'picture-card' },
|
|
|
},
|
|
|
components: {},
|
|
|
data: () => ({
|
|
@@ -60,7 +71,7 @@ export default {
|
|
|
return true;
|
|
|
},
|
|
|
outLimit() {
|
|
|
- this.$message.error('只允许上传1张');
|
|
|
+ this.$message.error('只允许上传1个文件');
|
|
|
},
|
|
|
onSuccess(response, file, fileList) {
|
|
|
//将文件整理好传回父组件
|