1.上传图片组件
<template>
<div class="simg-block">
<div class="ct">
<!-- {
{ imgValue }} -->
<!-- {
{ fileList }} -->
<el-upload
ref="upLoad"
class="upload-demo"
:class="{
'drag-demo': showType === 'drag',
islimit: Array.isArray(imgValue) && imgValue.length < limit,
btn: showType === 'button'
}"
:action="uploadFileUrl"
name="multipartFile"
:on-preview="handlePreview"
:on-remove="handleRemove"
:show-file-list="limit > 1 ? true : showFileList"
:on-error="handleError"
:list-type="limit > 1 ? 'picture-card' : 'text'"
:on-progress="handleProgress"
:before-remove="beforeRemove"
:before-upload="beforeUpload"
:limit="limit"
:drag="showType === 'drag' ? true : false"
:on-success="successUpload"
:on-exceed="handleExceed"
:file-list="fileList"
>
<template v-if="limit > 1 && showAddIcon">
<!-- <i #="default" class="el-icon-plus" /> -->
<solt name="default" />
</template>
<template v-if="showType === 'img' && showAddIcon">
<!-- {
{ showType === 'img' && showAddIcon }} -->
<span v-if="isLoading" v-loading="true" class="loadicon" />
<!-- <img v-else-if="imgValue" class="imgurl" :src="imgValue" alt="" /> -->
<el-icon v-else><plus /></el-icon>
</template>
<template v-if="showType === 'button'">
<slot name="btnContent" />
<el-button v-if="!$slots.btnContent" type="primary">{
{
btnText
}}</el-button>
</template>
<template v-if="showType === 'drag'">
<div class="upload-container">
<div>
<i class="el-icon-upload" />
<div v-if="dragText" class="el-upload__text">
<em>{
{ dragText }}</em>
<!-- <p>支持扩展名: pdf</p> -->
<!-- <span
v-if="isLoading"
v-loading="true"
style=""
class="loadicon1"
/> -->
</div>
<div v-else class="el-upload__text">
<em>点击或将文件拖拽到上传</em>
<p>支持扩展名: pdf</p>
<!-- <span
v-if="isLoading"
v-loading="true"
style=""
class="loadicon1"
/>