效果如下图:
在components文件夹中添加组件,组件代码如下,直接复制即可使用,上传接口记得更改即可。
<template>
<div >
<el-form :model="form" label-width="160px">
<el-row>
<el-col :span="12">
<el-form-item label="身份证号:" style="margin-bottom: 15px !important;">
<el-input v-model="form.idcard" class="input-with-select" placeholder="请输入或上传身份证">
<el-upload slot="append"
:headers="headers"
action="/admin/sys-file/upload"
multiple
:limit="1"
:file-list="[]"
:show-file-list="false"
:before-upload="beforeUpload"
:on-success="handleSuccess">
<el-button size="small" type="primary">上传身份证</el-button>
</el-upload>
</el-input>
<