需要先通过七牛云的接口获取到token和key,然后再上传
一般项目会涉及到多个上传图片的地方,可以单独写个上传组件
<template>
<div>
<el-upload
class="avatar-uploader"
action="https://upload.qiniup.com"
accept="jpg,jpeg,png"
:data="uploadData"
:show-file-list="false"
:on-success="handleSuccess"
:before-upload="beforeUpload">
<img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
<div slot="tip" class="el-upload__tip" style="color: red;font-weight: bold">
<span>注:只能上传jpg/png文件</span>
<span v-if