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

101
Views
Dynamically change Template-Image via URL on vue-cli

So, basically i've searched the entire web(maybe not good enough?) for a Solution for the following Question/Situation.

At the Moment, I load an Image with the webpacks "require" function into my Template.

<div class="mt-5 mb-5 app-img">
              <img :src="img" alt="" >
          </div>
and

private img = require(`@/assets/patternImg/placeholder.webp`)

So actually now, i want to replace this Image in the same template.

First of all i know, that i can't use require anymore, since its static.

What I now got, is an array filled with URL-Strings which i want to use. I read some about lazy-loading images into websites, but im not quite sure, if lazyloading ist the solution since i must define constants.

The array comes out of a Database, where i store information which i can succesfully use on my template, but not the image-urls.

So how the array looks:

private imgURLs = ['`@/assets/patternImg/placeholder.webp`,`@/assets/patternImg/placeholder.webp`,...']

I can easily change the String inside the Array, i just need a concept/working solution for changing the image. The only requirement is, that the solution must function with the URLs. Other ideas will be may work too, but i got stuck in this situation with vue.

So it would be nice, if someone could help me.

Thx and Greets

ps. i use vuex/axios for Database-queries and buefy-css

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!