美文网首页
use axios to send file object to

use axios to send file object to

作者: ccphantom | 来源:发表于2017-11-28 08:05 被阅读0次
    data() {
        return {
            formData: {
                 product_id: '',
                 title: '',
                 description: '',
                 subsets: [],
            }
        }
    }
    
    // create FormData instance to pass to backend
    let fData = new FormData();
    fData.append('title', this.formData.title)
    fData.append('description', this.formData.description);
    for (let i=0; i<this.formData.files.length; i++) {
         fData.append('files', this.formData.files[i]);
    }
    for (let i=0; i<this.formData.subsets.length; i++) {
         fData.append('subsets', this.formData.subsets[i]);
    }
    fData.append('product_id', this.selected_product.id);
    

    相关文章

      网友评论

          本文标题:use axios to send file object to

          本文链接:https://www.haomeiwen.com/subject/xifsbxtx.html