在使用vben框架的过程中肯定会遇到上传和下载的需求,那么我们今天就来看看,在vben框架种是如何上传和下载文件的。
目录
上传
首先我们肯定是要在页面中创建一个按钮,然后根据type= "file"的input框类型的上传来实现上传,废话不多说,上代码。
html
<template>
<div>
<input
ref="inputRef"
type="file"
v-show="false"
accept=".xlsx, .xls"
@change="handleInputClick"
/>
<div @click="handleUpload">
<a-button type="primary" preIcon="ant-design:download-outlined">
用户信息导入
</a-button>
</div>
</div>
</template>