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

170
Views
datos laravel_api no visibles en la aplicación front-end Vue js

usando Vue js 3 como seguimiento para mostrar los datos de los clientes en la aplicación Vue CustomerList.vue

 <template> <div class="container"> <table class="table table-hover"> <thead> <tr> <th scope="col">#</th> <th scope="col">First Name</th> <th scope="col">Last Name</th> <th scope="col">Email</th> <th scope="col">Contact No</th> </tr> </thead> <tbody v-for="customer in customers" :key="customer.id"> <tr class="table-secondary"> <th scope="row">{{customer.id}}</th> <th scope="row">{{customer.fname}}</th> <th scope="row">{{customer.lname}}</th> <th scope="row">{{customer.email}}</th> <th scope="row">{{customer.contact_no}}</th> </tr> </tbody> </table> </div> </template> <script> import axios from 'axios'; export default { name:'CustomerList', data(){ return { customers:Array } }, created() { this.getCustomers }, methods: { async getCustomers() { let url = 'http://127.0.0.1:8000/api/customers'; await axios.get(url).then(response => { this.customers = response.data.customers; console.log(this.customers); }).catch(error => { console.log(error); }); } }, mounted() { console.log('Customer List Component mounted'); } } </script>

He seguido Laravel_api web.php

 Route::get('customers',[App\Http\Controllers\CustomerController::class, 'getCustomers']);

ControladorDeCliente.php

 public function getCustomers(){ $customers = Customer::all(); return response()->json( [ 'customers' => $customers, 'message' => 'Customers', 'code' => 200 ] ); }

pero cuando se ejecutan ambas aplicaciones, los datos de la tabla no son visibles en el archivo vue y tampoco se imprimen los datos de los objetos de la consola. ¿Cómo podría solucionar este problema aquí?

about 4 years ago · Juan Pablo Isaza
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!