1. Upload vue image, use element UI to upload components and write them yourself
<el-upload action="string" :http-request="uploadImg" :show-file-list="false"> <el-button v-perm="'b:img:upload'" size="small" type="primary">Click to upload</el-button> </el-upload> <div class="imgStyle mar_top10"> <img width="100%" :src="dialogImageUrl" alt=""> </div>
2. Upload the pictures and update the modified pictures in real time
method : { uploadImg(item) { var isFlag = ( == 'image/jpeg' || == 'image/png')? true : false; if(!isFlag){ this.$message({ type: 'warning', message: 'Uploading images can only be in JPG or PNG format!' }) return false } let formData = new FormData(); ('file', );//If viewed, use ('file') (formData).then(res => { var res = ; if( == 200){ this.$message({ type: 'success', message: 'Uploaded successfully' }) = + '?' + new Date().getTime();//new Date().getTime() uses timestamp to replace each modified picture } }) } }
The above article vue has been updated in real time after modifying the picture. This is all the content I share with you. I hope it can give you a reference and I hope you can support me more.