-1

我想更新下拉列表。这是我的下拉菜单

<div v-for="(field, key) in config" :key="key">
  <div>
    <v-row>
      <v-col cols="1">
        <div class="mt-4 ml-3">
        </div>
      </v-col>
      <v-col cols="5">
        <v-autocomplete
          dense
          :items="items[key]"
          item-text="description"
          item-value="id"
          no-filter
          return-object
          single-line
          @change="(event) => updateData(event, key)"
          @click="click()"
        >
        </v-autocomplete>
      </v-col>
    </v-row>
  </div>
</div>

methods: {
    updateData(value, index) {
      getReport(this.id, this.param).then((res) => {
        this.items[index] = res.data.data;
      });
    },
  },

和我的代码。如何更新 this.items [index]。这种方式正确吗?它不会更新 this.items。

4

1 回答 1

1

Try to avoid this reactivity issue by using this.$set helper :

this.$set(this.items,index,res.data.data);
于 2022-01-15T21:56:02.460 回答