Level 6
I got it already!
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm using vue and I need to detect when the img tag responds with a 404, I found that i can execute a function adding the attribute onerror, on that attribute I call a vue js function but i thinks im not doing it on the right way.
<template>
<div class="camera" v-if="isStreaming">
<img :src="'/api/camera/' + camera.slug + '/livestreaminga'" onerror="withOutConnection()">
</div>
</template>
<script>
export default{
props: {
camera: {
type: Object,
twoWay: true,
required: true,
}
},
data(){
return {
isStreaming: true
}
},
methods: {
withOutConnection(){
console.log('The cameras' + this.camera.ip + ':' + this.camera.port + ' is down')
this.isStreaming = false;
}
}
}
</script>
This is the code, the error on the console is:
Uncaught ReferenceError: withOutConnection is not defined
How do I have to call the function withOutConnection
Please or to participate in this conversation.