Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

111
Views
Searching in an array with computed in Vue 3

I am trying to create a searching component using Vue 3 in cli i import data from json file and I have tried many functions but the search filter doesn't work so i need a search filter function

this is my code

    import data from "@/assets/data.json";

export default {
  name: "Home",
  data: function () {
    return {
      allData: data,
      search: "",
    };
  },
  components: { myComp, foooter, headeer },
  computed: {
    filter() {
      return this.allData.filter((item) =>
        item.body.toLowerCase().includes(this.search.toLowerCase())
      );
    },
  },
};

and this is the input and cards that i show in


    <div class="row justify-content-md-center">
          <div class="col-md-4">
            <div class="form-group">
              <input
                class="form-control"
                type="text"
                name="search"
                placeholder="search..."
                v-model="search"
              />
            </div>
          </div>
        </div>

        <div class="row">
          <my-comp
            v-for="item in filter"
            :key="item.id"
            :id="item.id"
            :imgsrc="item.imgsrc"
            :price="item.price"
            :city="item.city"
            :country="item.country"
            :reviewnum="item.reviewnum"
            :daynum="item.daynum"
          />
        </div>
about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!