So this is my HTML:
<img v-bind:src="'@/assets/'+imgUrl()+'.png'" alt="thumbs-Up" id="thumbsUp">
And this is the script:
import axios from 'axios'
export default {
data(){
return{
status:''
}
},
methods: {
getStatus(){
axios.get('/api/health')
.then(response => this.status = response.data.status)
.catch(err => console.log(err.message))
},
imgUrl(){
if (this.status =='UP')
return "thumbsUp"
else
return "thumbsDown"
}
}
}
The output is the alternative text, even if I got the right path http://localhost:8080/@/assets/thumbsUp.png