update 图片上传

This commit is contained in:
2023-04-28 15:04:45 +08:00
parent b9f29d5179
commit 61f3103824
2 changed files with 41 additions and 34 deletions

View File

@@ -17,20 +17,7 @@
<div id="container"></div>
</div>
<div>上传图片</div>
<el-upload
action="http://localhost:8080/common/uploadOSS"
:headers="headers"
list-type="picture-card"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
:on-success="handleSuccess"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
<!-- <div class="img">-->
<!-- <el-input-->
@@ -77,26 +64,11 @@ export default {
placeSearch: "",
stationId: this.$route.params.id,
avatar: "",
headers: {
Authorization: "Bearer " + getToken()
},
imageUrl: null
};
},
methods: {
handleSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw);
console.log("图片上传成功 url", this.imageUrl);
console.log("图片上传成功 res", res);
},
handleRemove(file, fileList) {
console.log(file, fileList);
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
console.log(this.dialogImageUrl)
this.dialogVisible = true;
},
// 点击搜索按钮
send() {
this.searchPlaceInput = this.inputObject.userInput;