", "datePublished": "2020-07-21T05:49:05Z", "@type": "Comment", "author": {"url": "https://www.v2ex.com/member/azcvcza", "@type": "Person", "name": "azcvcza"}}, {"text": "逐渐 stackoverflow", "datePublished": "2020-07-21T05:57:54Z", "@type": "Comment", "author": {"url": "https://www.v2ex.com/member/Terry05", "@type": "Person", "name": "Terry05"}}, {"text": "@azcvcza 谢谢", "datePublished": "2020-07-21T06:39:35Z", "@type": "Comment", "author": {"url": "https://www.v2ex.com/member/TomeWong", "@type": "Person", "name": "TomeWong"}}, {"text": "为啥会在这问这种基础问题- -b stackoverflow 不香么", "datePublished": "2020-07-22T02:23:35Z", "@type": "Comment", "author": {"url": "https://www.v2ex.com/member/wednesdayco", "@type": "Person", "name": "wednesdayco"}}, {"text": "逐渐 stackoverflow", "datePublished": "2020-07-22T06:08:29Z", "@type": "Comment", "author": {"url": "https://www.v2ex.com/member/Sven0706", "@type": "Person", "name": "Sven0706"}}, {"text": "....", "datePublished": "2020-07-23T01:42:43Z", "@type": "Comment", "author": {"url": "https://www.v2ex.com/member/myCupOfTea", "@type": "Person", "name": "myCupOfTea"}}], "interactionStatistic": [{"userInteractionCount": 2437, "@type": "InteractionCounter", "interactionType": "https://schema.org/ViewAction"}, {"userInteractionCount": 8, "@type": "InteractionCounter", "interactionType": "https://schema.org/ReplyAction"}], "text": "
<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 年 7 月 21 日 via Android
new Uploader()
|
2
maichael 2020 年 7 月 21 日
你也没有实例化 Uploader 呀
|
3
azcvcza 2020 年 7 月 21 日
在底下另起一行<script> var uploader = new Uploader() </script>
|
4
Terry05 2020 年 7 月 21 日
逐渐 stackoverflow
|
6
wednesdayco 2020 年 7 月 22 日
为啥会在这问这种基础问题- -b stackoverflow 不香么
|
7
Sven0706 2020 年 7 月 22 日
逐渐 stackoverflow
|
8
myCupOfTea 2020 年 7 月 23 日
....
|