[Vuejs]-Filter an object key:val in vue

3👍

You can use Object.keys for filtering your keys where the values match.

this.nurseListSpeciality2 = Object.keys(this.specialityTest).filter((val) => this.specialityTest[val] === "ג6");

Finally, when rendering you can loop over the array of keys that will be returned and the render values associated with those keys

<ul>
    <li v-for="val in nurseListSpeciality2" :key="val">
      {{ specialityTest[val] }}
    </li>
</ul>

Leave a comment