You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
4.3 KiB
125 lines
4.3 KiB
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>vue-upload-component</title>
|
|
<style type="text/css">
|
|
#app {
|
|
position: relative;
|
|
}
|
|
.file-upload {
|
|
display: block;
|
|
}
|
|
.file-upload span{
|
|
display: block;
|
|
font-size: 18px;
|
|
padding: 1em;
|
|
font-weight: bold;
|
|
border: 1px solid #888;
|
|
}
|
|
.drop-active {
|
|
top: 0;
|
|
bottom: 0;
|
|
right: 0;
|
|
left: 0;
|
|
position: absolute;
|
|
opacity: .4;
|
|
background: #000;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="app">
|
|
<table style="width: 100%; border: 1px solid #ddd;">
|
|
<thead>
|
|
<tr>
|
|
<th>Index</th>
|
|
<th>ID</th>
|
|
<th>Name</th>
|
|
<th>Size</th>
|
|
<th>Progress</th>
|
|
<th>Speed</th>
|
|
<th>Active</th>
|
|
<th>Error</th>
|
|
<th>Errno</th>
|
|
<th>Success</th>
|
|
<th>Abort</th>
|
|
<th>Delete</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="file in files">
|
|
<td>{{$index}}</td>
|
|
<td>{{file.id}}</td>
|
|
<td>{{file.name}}</td>
|
|
<td>{{file.size | formatSize}}</td>
|
|
<td>{{file.progress}}</td>
|
|
<td>{{file.speed | formatSize}}</td>
|
|
<td>{{file.active}}</td>
|
|
<td>{{file.error}}</td>
|
|
<td>{{file.errno}}</td>
|
|
<td>{{file.success}}</td>
|
|
<td @click="file.active = false">Abort</td>
|
|
<td @click="remove(file)">x</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<br/>
|
|
<br/>
|
|
<table style="width: 100%; border: 1px solid #ddd;" >
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<file-upload title="Add upload files" class="file-upload" name="file" post-action="./post.php" put-action="./put.php" :extensions="extensions" :accept="accept" :multiple="multiple" :size="size" v-ref:upload :drop="drop"></file-upload>
|
|
</td>
|
|
<td>
|
|
<button v-if="$refs.upload && $refs.upload.active" type="submit" @click.prevent="$refs.upload.active = !$refs.upload.active">Stop upload</button>
|
|
<button v-else type="submit" @click.prevent="$refs.upload.active = !$refs.upload.active">Start upload</button>
|
|
</td>
|
|
<td>
|
|
<label>
|
|
Accept: <input type="text" v-model="accept">
|
|
</label>
|
|
</td>
|
|
<td>
|
|
<label>
|
|
Extensions: <input type="text" v-model="extensions">
|
|
</label>
|
|
</td>
|
|
<td>
|
|
<label>
|
|
Drop: <input type="checkbox" id="checkbox" v-model="drop">
|
|
</label>
|
|
</td>
|
|
<td>
|
|
<label>
|
|
Max file size: <input type="text" v-model="size">
|
|
</label>
|
|
</td>
|
|
<td>
|
|
<label>
|
|
Multiple: <input type="checkbox" id="checkbox" v-model="multiple">
|
|
</label>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
Active: {{$refs.upload.active}}
|
|
</td>
|
|
<td>
|
|
Uploaded: {{$refs.upload.uploaded}}
|
|
</td>
|
|
<td>
|
|
Drop active: {{$refs.upload.dropActive}}
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div v-show="$refs.upload.dropActive" class="drop-active">
|
|
Drop ing
|
|
</div>
|
|
</div>
|
|
<script src="./dist/example.js"></script>
|
|
</body>
|
|
</html>
|