Vue: how to bind image onerror event

Created on 12 Jul 2016  Â·  1Comment  Â·  Source: vuejs/vue

When the image url is returned 404, it will triggere onerror event.
I want to use it as such, but it does not take effect

<template>
   <img :src="avatarUrl" @onerror="imageLoadOnError" />
</template>
<script>
export default {
    methods: {
      imageLoadOnError () {
        this.avatarUrl = DEFAULT_AVATAR
      }
    }
}
</script>

Most helpful comment

Use @error. And please use our forum or Gitter for questions like this. The repo issue list is strictly for bug reports and feature requests, as specified in the contributing guidelines. Thanks.

>All comments

Use @error. And please use our forum or Gitter for questions like this. The repo issue list is strictly for bug reports and feature requests, as specified in the contributing guidelines. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

loki0609 picture loki0609  Â·  3Comments

aviggngyv picture aviggngyv  Â·  3Comments

lmnsg picture lmnsg  Â·  3Comments

robertleeplummerjr picture robertleeplummerjr  Â·  3Comments

julianxhokaxhiu picture julianxhokaxhiu  Â·  3Comments