[Vuejs]-Vue – How can I list the array in the first object of the array with Vuex using mapState

0👍

You can modify the filteredList to be

  computed: {
    ...mapState(['players']),
    filteredList() {
      const filteredPlayers = this.players.filter(player => {
        let flag = false;
        if(player.names) {
         player.names.forEach(name => {
          if(name.toLowerCase().includes(this.search.toLowerCase()) flag = true;
         });
        }
       return flag;
    });
    return filteredPlayers;
  },

Here is how you display names

<div class="Players-inner-cards">
          <Clubs class="Players-inner-cards-svg" v-bind:name="players.id" />
          <CostumText tag="strong" lang="tr" class="Players-inner-cards-text">
            {{ players.names.valueOf() }}
          </CostumText>
        </div>

Leave a comment