1
My list remains the same after deleting an item, only refreshes when I hit F5 on screen. I’ve tried using componentKey, but it only works when I click 2 clicks.
Follow current component code:
<template>
  <table>
    <thead>
      <tr>
        <td>ID</td>
        <td>Nome</td>
        <td>Raça</td>
        <td>#</td>
      </tr>
    </thead>
    <tbody>
      <tr v-for="d in dog.data" :key="d.id">
        <td>{{ d.id }}</td>
        <td>{{ d.titulo }}</td>
        <td>{{ d.conteudo }}</td>
        <td><button @click="deleteDog(d.id)">Deletar</button></td>
      </tr>
    </tbody>
  </table>
</template>
<script>
import api from "../services/api";
export default {
  data() {
    return {
      dog: [],
    };
  },
  mounted() {
    api.get("dogs").then((response) => (this.dog = response.data));
  },
  methods: {
    deleteDog(id) {
      api.delete("dog/" + id);
    },
  },
};
</script>
It worked, thank you very much.
– Jonatan Abade