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

121
Views
Nuxt image keeps breaking on page change

I have image displayed on my Nuxt page but anytime I navigate away from it back the image breaks and I do not know why.

I have this in my code

<img :src="baseUrl + 'storage/'+ front.featured_image" alt="post-title" />

and my script

data: () => ({
  frontpage: [],
    baseUrl: process.env.BASE_URL
}),
async asyncData({ $axios }) {
  const response = await $axios.get('/api/frontpage')
  return { frontpage: response.data.posts }
},

I have a .env file and I have the following inside it BASE_URL=http://localhost/ and I also have the following inside nuxt.config.js

env:{
  baseUrl: process.env.BASE_URL || 'http://localhost/'
}

My API is built using laravel and it is loading from http://localhost/ but Nuxt keeps going back to localhost:3000 on page change.

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

0

You can check my previous answer here: https://stackoverflow.com/a/67705541/8816585

This may help

export default {
  publicRuntimeConfig: {
    baseUrl: process.env.BASE_URL,
  },
}

Otherwise, this configuration of Axios may also help!

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!