Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/382.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 对数组vuejs的每个值执行相同的操作_Javascript_Arrays_Vuejs2 - Fatal编程技术网

Javascript 对数组vuejs的每个值执行相同的操作

Javascript 对数组vuejs的每个值执行相同的操作,javascript,arrays,vuejs2,Javascript,Arrays,Vuejs2,我正在进行许多文件输入(数组),但初始单词相同,如下所示: <input type file="file0"/> <input type file="file1"/> 我试过了 this.$upload.reset('file*') this.$upload.reset('file{*}' this.$upload.reset('file${*}如果您使用vue.js上载文件,为什么不监听onChange事件: <input type="file" v-on:ch

我正在进行许多文件输入(数组),但初始单词相同,如下所示:

<input type file="file0"/>
<input type file="file1"/>
我试过了

this.$upload.reset('file*')
this.$upload.reset('file{*}'

this.$upload.reset('file${*}

如果您使用vue.js上载文件,为什么不监听onChange事件:

<input type="file" v-on:change="onFileChange" name="file0">
<input type="file" v-on:change="onFileChange" name="file1">
<input type="file" v-on:change="onFileChange" name="file0">
<input type="file" v-on:change="onFileChange" name="file1">
methods: {
    onFileChange(e) {
      var files = e.target.files || e.dataTransfer.files;
      if (files.length){
            // Perform common action
      }
 }