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

141
Views
Cómo obtener y mostrar datos en la carga y también en la búsqueda

Me gustaría obtener y mostrar datos en carga. Después de esto, me gustaría mostrar datos en la búsqueda.

Ahora solo logro mostrar datos en la clave de búsqueda. También me gustaría mostrar la lista de artistas al cargar la página.

  1. Cómo mostrar datos en la página de carga
  2. Cómo mostrar datos en la búsqueda

¡Gracias por adelantado!

 <template> <div class="body"> <div class="searchBar"> <i class="bi bi-search"></i> <input placeholder="Search for artists" type="text" v-model="searchQuery" @keyup="searchArtist" /> </div> <div class="artists"> <div className="artist__list" v-for="artistResult in result" :key="artistResult.id" > <h4>{{ artistResult.name }}</h4> </div> </div> </div> </template> <script> import axios from "axios"; import "./body.css"; export default { data() { return { artists: [], result: [], searchQuery: "", }; }, mounted() { this.fetchArtists(); }, computed: { filteredResult() { const res = this.result; const search = this.searchQuery; if (!search) { return res; } return res.filter((item) => item.name.toLowerCase().includes(search.toLowerCase()) ); }, }, methods: { searchArtist() { axios .get(`http://localhost:3000/artists?q=${this.searchQuery}`) .then((response) => { this.result = response.data; }) .catch((error) => { console.error(error); }); }, fetchArtists() { axios .get("http://localhost:3000/artists") .then((response) => { this.artists = response.data; }) .catch((error) => { console.error(error); }); }, }, }; </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Al buscarlo, lo necesito para vincular la respuesta de API al resultado de la matriz vacía.

 return { result: [], searchQuery: "", }; }, fetchArtists() { axios .get("http://localhost:3000/artists") .then((response) => { this.result = response.data; }) .catch((error) => { console.error(error); }); },
about 4 years ago · Juan Pablo Isaza Report
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!