-1

I want to update dropdown list. Here is my dropdown

<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;
      });
    },
  },

and my code. How can I update the this.items[index]. Is this way correct ? It does not update this.items.

Boussadjra Brahim
  • 82,684
  • 19
  • 144
  • 164
gamze37
  • 1
  • 1

1 Answers1

1

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

this.$set(this.items,index,res.data.data);
tony19
  • 125,647
  • 18
  • 229
  • 307
Boussadjra Brahim
  • 82,684
  • 19
  • 144
  • 164