【问题标题】:passing from an input data as an array of images to the api从输入数据作为图像数组传递到 api
【发布时间】:2020-04-21 12:41:52
【问题描述】:

我正在尝试从输入乘法图像传递到 api,如下所示:

<el-form-item label="images" prop="images">
  <el-input name="files" type="file" multiple="multiple" v-model="property.images" v-on:input="changed"/>
</el-form-item>

然后将数据传递为:

  data() {
    return {
      property: { title: '', description: '', price: 0, images []},

然后传递给api:

  createProperty() {
      WebAppAPI.CreateProperty(this.property).then(response => {

但只传递一个字符串 url,即使我添加了几张图片。

知道我还需要做什么来传递数组而不是字符串吗?

【问题讨论】:

标签: javascript vue.js vuejs2 vue-component vuetify.js


【解决方案1】:

你可以参考这个demo fiddle。

https://jsfiddle.net/RiddhiParekh/s8ot36kh/

 <el-upload multiple="multiple" class="upload-demo" action="https://jsonplaceholder.typicode.com/posts/" :on-change="handleChange" :file-list="fileList3">
  <el-button size="small" type="primary">Click to upload</el-button>
  <div slot="tip" class="el-upload__tip">jpg/png files with a size less than 500kb</div>
</el-upload>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-07-01
    • 2011-02-22
    • 1970-01-01
    • 2018-10-15
    • 1970-01-01
    • 2015-12-27
    • 2014-07-20
    相关资源
    最近更新 更多