vue如何获取拖拽文件列表?
网友回复
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
margin: 0;
padding: 20px;
font-family: Arial, sans-serif;
transition: background-color 0.3s ease;
}
.file-drop {
border: 2px dashed #ccc;
padding: 20px;
text-align: center;
cursor: pointer;
}
.file-drop:hover {
background-color: #f0f0f0;
}
.file-list {
margin-top: 20px;
}
.file-list ul {
list-style-type: none;
padding: 0;
}
.file-list li {
margin-bottom: 5px;
}
</style>
</head>
<body>
<div id="app">
<div class="file-drop" v-if="!file">
<p>拖拽单个文件到这里 (仅限 .jpg 和 .png 文件)</p>
</div>
<div class="file-list" v-else>
<ul>
<li>
{{ file.name }} ({{ file.size }} bytes)
...点击查看剩余70%


