Vue-js image batch upload
<head>
<meta charset="UTF-8">
<title>vue.js图片批量上传插件</title>
<script src="js/vue2.2.2.js"></script>
<style>
.upload_warp_img_div_del {
position: absolute;
top: 6px;
width: 16px;
right: 4px;
}
.upload_warp_img_div_top {
position: absolute;
top: 0;
width: 100%;
height: 30px;
background-color: rgba(0, 0, 0, 0.4);
line-height: 30px;
text-align: left;
color: #fff;
font-size: 12px;
text-indent: 4px;
}
.upload_warp_img_div_text {
white-space: nowrap;
width: 80%;
overflow: hidden;
text-overflow: ellipsis;
}
.upload_warp_img_div img {
max-width: 100%;
max-height: 100%;
vertical-align: middle;
}
.upload_warp_img_div {
position: relative;
height: 100px;
width: 120px;
border: 1px solid #ccc;
margin: 0px 30px 10px 0px;
float: left;
line-height: 100px;
display: table-cell;
text-align: center;
background-color: #eee;
cursor: pointer;
}
.upload_warp_img {
border-top: 1px solid #D2D2D2;
padding: 14px 0 0 14px;
overflow: hidden
}
.upload_warp_text {
text-align: left;
margin-bottom: 10px;
padding-top: 10px;
text-indent: 14px;
border-top: 1px solid #ccc;
font-size: 14px;
}
.upload_warp_right {
float: left;
width: 57%;
margin-left: 2%;
height: 100%;
border: 1px dashed #999;
border-radius: 4px;
line-height: 130px;
color: #999;
}
.upload_warp_left img {
margin-top: 32px;
}
.upload_warp_left {
float: left;
width: 40%;
height: 100%;
border: 1px dashed #999;
border-radius: 4px;
cursor: pointer;
}
.upload_warp {
margin: 14px;
height: 130px;
}
.upload {
border: 1px solid #ccc;
background-color: #fff;
width: 650px;
box-shadow: 0px 1px 0px #ccc;
border-radius: 4px;
}
.hello {
width: 650px;
margin-left: 27%;
text-align: center;
}
</style>
</head>
<body><script src="/demos/googlegg.js"></script>
<div id="app">
<div class="hello">
<div class="upload">
<div class="upload_warp">
<div class="upload_warp_left" @click="fileClick">
<img src="./upload.png">
</div>
<div class="upload_warp_right" @drop="drop($event)" @dragenter="dragenter($event)" @dragover="dragover($event)">
或者将文件拖到此处
</div>
</div>
<div class="upload_warp_text">
选中{{imgList.length}}张文件,共{{bytesToSize(this.size)}}
</div>
<input @change="fileChange($event)" type="file" id="upload_file" multiple style="display: none">
<div class="upload_warp_img" v-show="imgList.length!=0">
<div class="upload_warp_img_div" v-for="(item,index) of imgList">
<div class="upload_warp_img_div_top">
<div class="upload_warp_img_div_text">
{{item.file.name}}
All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn
Related Article
16 May 2016
I have never been able to find an example of jquery uploading images on the Internet. Today, due to work needs, I searched for a long time on the Internet and found an incomplete example. I modified it and it is now available, but only for It cannot be used under IE and Firefox because the local uploaded image path cannot be obtained under Firefox. I hope it can be helpful to novices.
30 Nov 2019
This article introduces how to use imgFileupload.js, an image batch upload plug-in. I hope it will be helpful to students learning js. Select images in batches, limit image types through accept, and limit the size of a single file through FileSize.
16 May 2016
The script uses the components of WScript.Shell and Scripting.FileSystemObject, so it must be run under IE and with the security option turned on; Jquery is also used. The code is only client code, as for the server's receiving code, it is much better online.
19 Jun 2019
Webuploader is mainly used to upload files. It supports batch upload and image preview. Image preview generates base64 data from the image and uses it directly in the tag, so the effect that can be achieved is that you can see the upload effect before actually uploading the image.
13 Jul 2016
PHP image and file batch upload code. PHP image and file batch upload code. Whether it is file or image batch upload, the first thing we do is to make an array variable such as name=userfile[] in HTML. In PHP acceptance, we do for ($_i=0; $
30 Jun 2023
How to handle image uploading in Vue development. With the popularity of the Internet and the development of technology, image uploading has become one of the common functions in many websites and applications. For Vue developers, how to efficiently handle image uploading is an important skill. In this article, we will discuss how to handle image uploading in Vue development, and introduce some practical methods and techniques. First, let's look at the basic steps for handling image uploads in Vue. First, we need to add a file upload function to the web page
08 Mar 2018
This article mainly shares with you the implementation code of JS uploading images. This article mainly shares it with you in the form of code. I hope it can help you.
29 Jul 2016
Upload images in batches: PHP's simple method to upload images in batches: This article describes an example of PHP's simple method to upload images in batches. Share it with everyone for your reference, as follows: <phpfunction upload_multi($path,$photo,$i){$uploaddir = './'.$path;//File storage directory if(!file_exists($uploaddir))/ /If the directory does not exist, create a new one $uploaddir=mkdir($uploaddir);$piece = explode
Hot Tools
jQuery2019 Valentine's Day Confession Fireworks Animation Special Effects
A very popular jQuery Valentine's Day confession fireworks animation special effect on Douyin, suitable for programmers and technical geeks to express their love to the girl they love. No matter you choose to be willing or not, you have to agree in the end.
layui responsive animated login interface template
layui responsive animated login interface template
520 Valentine's Day confession web animation special effects
jQuery Valentine's Day Confession Animation, 520 Confession Background Animation
Cool system login page
Cool system login page
HTML5 tape music player-CASSETTE PLAYER
HTML5 tape music player-CASSETTE PLAYER