Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
437 views
in Technique[技术] by (71.8m points)

js动态添加 input type="file" 后,每次都只上传第一个 file 中的文件

    <div class="wrap">
      <div>
            <input type="file" :id="index" @change="toUpload"/>
      </div>
    </div>
    data() {
      return {
        index: 0
      };
    },

每新增一个input ,this.index++


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

这就需要看你 toUpload 写的是什么了。

当然,我猜你肯定是用id获取的。你这个现在是有问题的,你这个id看上去是会重复的呀。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
...