Skip to content

how to bind image onerror event #3261

@nqdy666

Description

@nqdy666

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions