<el-upload
class="upload-demo" <!-- 为上传组件添加类名 'upload-demo',方便自定义样式 -->
action="#" <!-- 指定上传的URL,这里"#"表示尚未设置实际上传接口 -->
list-type="picture" <!-- 设置上传列表的展示类型为图片模式 -->
accept="image/jpeg,image/gif,image/png" <!-- 限制上传的文件类型为jpeg、gif、png格式的图片 -->
:limit="1" <!-- 设置最大上传文件数量为1 -->
:on-exceed="handleExceedPermitLicense" <!-- 当上传文件数超过限制时触发的方法 -->
:before-upload="beforeUploadPermitLicense" <!-- 在文件上传之前触发的方法,可用于验证文件等 -->
>
<!-- 上传按钮及文案 -->
<div>
<el-button type="primary" style="width: 100px;margin-top: 20px;">
{{ form.picUrl ? '重新上传' : '上传照片' }}
</el-button>
</div>
<!-- 删除已上传文件的按钮,根据条件是否显示 -->
<!-- 注释掉的部分是另一种根据 routeInfo.type 控制按钮文案和样式的示例 -->
<!--
<el-button
style="width: 112px;margin: 20px 0 10px 0"
size="small"
:type="routeInfo.type == 1 ? 'primary' : ''"
>
{{ routeInfo.type == 1 ? '上传照片' : '重新上传' }}
</el-button>
-->
<!-- 已上传文件列表中每个文件的删除按钮 -->
<span class="el-upload-list__item-delete" @click="handleRemove(file)">
<i class="el-icon-delete"></i>
</span>
</el-upload>