[Vuejs]-How to Vue.set with item id instead of index

0👍

simple solution i found that use findIndex methods

var vm = this;
      this.$echo.channel("accept-coin").listen("AcceptCoin", response => {
        var indexid = vm.coins.findIndex(f => f.id === response.coin.id); //<-- this find index with coin id so then i can do whatever 
        vm.$set(vm.coins, indexid, response.coin);
        vm.coins[indexid].result = response.result;
        vm.$auth.fetchUser();
        setTimeout(() => {
          this.coins.splice(indexid, 1);
        }, 10000);
      });

Hope this helps

Leave a comment