Vuetify: [Feature Request] Add prop to v-img to disable onerror logging

Created on 18 Mar 2019  路  4Comments  路  Source: vuetifyjs/vuetify

Problem to solve

Currently v-img will log an error to the console if the URL fails to load.

This is undesirable because sometimes the URL might be provided by a user, and we should be able to prevent console error logs.

Proposed solution

Add a Boolean prop to VImg.ts called logErrors with a default value of true.

Change this line: image.onerror = this.onError to be: image.onerror = this.logErrors && this.onError;

VImg feature

Most helpful comment

I believe the default should be the same as the standard html components, that is no error logging by default.

All 4 comments

@DanielStout5 maybe noErrors?

For now we're working around this with a wrapper:

import VImg from 'vuetify/lib/components/VImg'

export default VImg.extend({
  name: 'VImageWrapper',
  methods: {
    onError() {
      this.$emit('error', this.src)
    }
  }
})

I believe the default should be the same as the standard html components, that is no error logging by default.

Removed the log on error, still warns about decode failures though. You'll be able to turn off all warnings with Vuetify.config.silent: #10909

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dohomi picture dohomi  路  3Comments

smousa picture smousa  路  3Comments

itanka9 picture itanka9  路  3Comments

sebastianmacias picture sebastianmacias  路  3Comments

Antway picture Antway  路  3Comments