<div class="uploader">
<input type="file" id="file" multiple>
</div>
<script src="../src/index.js" type="module"></script>
import Queues from './widgets/queue.js'
class Uploader {
constructor () {
this.container = document.getElementById('file');
this.queue = new Queues();
this.pool = [];
this.container.addEventListener('change', function() {
var filesList = document.querySelector('#files').files;
if(filesList.length==0){ //如果取消上传,则改文件的长度为 0
return;
}else{
//如果有文件上传,这在这里面进行
console.log(filesList);
Queues.addFile(filesList);
}
})
}
}
export default Uploader
运行后,选择后,js 中的代码没有触发,求原因
谢谢!!!
1
ChanKc 2020-07-21 12:17:25 +08:00 via Android
new Uploader()
|
2
maichael 2020-07-21 12:27:44 +08:00
你也没有实例化 Uploader 呀
|
3
azcvcza 2020-07-21 13:49:05 +08:00
在底下另起一行<script> var uploader = new Uploader() </script>
|
4
Terry05 2020-07-21 13:57:54 +08:00
逐渐 stackoverflow
|
6
wednesdayco 2020-07-22 10:23:35 +08:00
为啥会在这问这种基础问题- -b stackoverflow 不香么
|
7
Sven0706 2020-07-22 14:08:29 +08:00
逐渐 stackoverflow
|
8
myCupOfTea 2020-07-23 09:42:43 +08:00
....
|