mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-13 11:49:49 +08:00
上传图片
This commit is contained in:
@@ -16,17 +16,31 @@
|
|||||||
|
|
||||||
<div id="container"></div>
|
<div id="container"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="img">
|
<div>上传图片</div>
|
||||||
<el-input
|
<el-upload
|
||||||
placeholder="请选择图片"
|
action="https://jsonplaceholder.typicode.com/posts/"
|
||||||
style="width: 50%"
|
list-type="picture-card"
|
||||||
type="file"
|
:on-preview="handlePictureCardPreview"
|
||||||
@change="onFileChange"
|
:on-remove="handleRemove"
|
||||||
ref="iptRef"
|
|
||||||
></el-input
|
|
||||||
>
|
>
|
||||||
<el-button style="width: 85px">上传图片</el-button>
|
<!-- :headers="headers"-->
|
||||||
</div>
|
<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-->
|
||||||
|
<!-- placeholder="请选择图片"-->
|
||||||
|
<!-- style="width: 50%"-->
|
||||||
|
<!-- type="file"-->
|
||||||
|
<!-- @change="onFileChange"-->
|
||||||
|
<!-- ref="iptRef"-->
|
||||||
|
<!-- ></el-input-->
|
||||||
|
<!-- >-->
|
||||||
|
<!--<!– <el-button style="width: 85px">上传图片</el-button>–>-->
|
||||||
|
<!-- </div>-->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -41,6 +55,11 @@ window._AMapSecurityConfig = {
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
dialogImageUrl: '',
|
||||||
|
dialogVisible: false,
|
||||||
|
// headers:{
|
||||||
|
// Authorization:this.$store.state.user.token
|
||||||
|
// },
|
||||||
map: null,
|
map: null,
|
||||||
autoOptions: {
|
autoOptions: {
|
||||||
input: "",
|
input: "",
|
||||||
@@ -58,6 +77,14 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleRemove(file, fileList) {
|
||||||
|
console.log(file, fileList);
|
||||||
|
},
|
||||||
|
handlePictureCardPreview(file) {
|
||||||
|
this.dialogImageUrl = file.url;
|
||||||
|
console.log(this.dialogImageUrl)
|
||||||
|
this.dialogVisible = true;
|
||||||
|
},
|
||||||
// 点击搜索按钮
|
// 点击搜索按钮
|
||||||
send() {
|
send() {
|
||||||
this.searchPlaceInput = this.inputObject.userInput;
|
this.searchPlaceInput = this.inputObject.userInput;
|
||||||
@@ -160,6 +187,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
onFileChange(e) {
|
onFileChange(e) {
|
||||||
|
console.log(e,'上传图片')
|
||||||
// 1.获取用户选择的文件列表
|
// 1.获取用户选择的文件列表
|
||||||
const fileList = e.target.files;
|
const fileList = e.target.files;
|
||||||
console.log(fileList);
|
console.log(fileList);
|
||||||
|
|||||||
Reference in New Issue
Block a user