话不多说,上代码!效果为点击图片上传!不好用你找我
<template>
<div>
<div style="width: 102px;height: 102px;border-radius: 50%;border:1px solid #CCC" @click="section()">
//动态图片路径
<img :src="$aws.url + urlData" style="width: 100px;height: 100px;border-radius: 50%;"/>
</div>
<input type="file" ref="iconFile" @change="fileChange" name="file" style="display: none"/>
</div>
</template>
<script>
import AWS from 'aws-sdk'
export default {
created () {
},
data(){
return{
objectKey:'',
urlData:'public/a95c0c550d934fd4b6edfc777670c5e9',
}
},
methods: {
section(){
//通过refs属性来获取点击事件,点击div实则点击input
this.$refs.iconFile.click()
},
file