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.
vue-upload-component/index.html

147 lines
4.9 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>Success</th>
<th>Abort</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<tr v-for="(file, index) 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.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="title"
class="file-upload"
:events="events"
:name="name"
:post-action="postAction"
:put-action="putAction"
:extensions="extensions"
:accept="accept"
:multiple="multiple"
:size="size"
:headers="headers"
:data="data"
:drop="drop"
:files="files"
ref="upload">
</file-upload>
</td>
<td>
<button v-if="upload.active" type="submit" @click.prevent="upload.active = !upload.active">Stop upload</button>
<button v-else type="submit" @click.prevent="upload.active = !upload.active">Start upload</button>
</td>
<td>
<label>
Auto start: <input type="checkbox" id="checkbox" v-model="auto">
</label>
</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.number="size">
</label>
</td>
<td>
<label>
Multiple: <input type="checkbox" id="checkbox" v-model="multiple">
</label>
</td>
</tr>
<tr>
<td>
Auto start: {{auto}}
</td>
<td>
Active: {{upload.active}}
</td>
<td>
Uploaded: {{upload.uploaded}}
</td>
<td>
Drop active: {{upload.dropActive}}
</td>
</tr>
</tbody>
</table>
<div v-show="upload.dropActive" class="drop-active">
Drop ing
</div>
</div>
<script src="./dist/example.js"></script>
</body>
</html>