[Vuejs]-Update a computed method from a function Vue

0👍

You should modify the data property transactions instead of updating computed one because it’s not correct what you’re doing this.sortedTransactions = search; since computed properties are not mutable, so your function should be like :

  searchResults() {
  const search = this.transactions.filter(transaction => { 
      return transaction.user_id.toLowerCase() === this.searchTable
    });
    this.transactions = search;
}

and the computed property sortedTransactions will be updated automatically

0👍

Define serchResults() in your method, listen to @key event, and pass it to the method to filter result.

Leave a comment