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

155
Views
Load an image (Vue.js, Django)

i am working on vue and i am bringing an image through django api rest

table.vue

<tbody>
  <tr v-for= "usu in usuarios" :key="usu.id_usuarios">
    <th>{{usu.id_usuarios}}</th>
    <td>{{usu.nombre}}</td>
    <td>{{usu.username}}</td>
    <td>{{usu.perfil}}</td>
    <td>   
      <img 
        src='{{usu.foto}}' 
        class="img-circle elevation-2" 
        alt="User Image" 
        width="60"
      >
    </td>
    <td>{{usu.estado}}</td>
    <td>{{usu.ultimo_ingreso}}</td>
    <td class="text-center">
      <button 
        @click="modificar=true; abrirModal(cat)" 
        type="button" 
        class="editar btn btn-primary">
        <i class = "fa fa-pencil-alt"></i>
      </button>
    </td>
    <td class="text-center">
      <button
        @click="eliminar(cat.id_categoria,cat.categoria)"
        type="button"
        class="eliminar btn btn-danger"
        data-toggle="modal"
        data-target="#modalEliminar"
      >
        <i class="fas fa-dumpster-fire"></i>
      </button>
    </td>
  </tr>
</tbody>

and this is the method

async listar() {
  const res = await axios.get('https://sistema-control-inventario.herokuapp.com/usuarios/');
  this.usuarios = res.data;
  this.image = res.data.foto;
},

and shows it in this way

enter image description here

and this appears in the code of the photo in the terminal

enter image description here

how do I get the photo correctly? because when I bring the {{usu.foto}} I get the link but when I put it in the src it doesn't work.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try to bind src:

:src='usu.foto'

or if that doesn't work, you can create method:

methods() {
  getImage(imagePath) {
    return require(imagePath);
  }
}

Then in template call that method:

<img :src="getImage(usu.foto)" alt="">
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!