Nuxt.js: Not firing @error event on img element

Created on 9 Apr 2019  路  6Comments  路  Source: nuxt/nuxt.js

Version

v2.5.1

Reproduction link

https://codesandbox.io/s/vy6863v787

Steps to reproduce

  1. Create an image element with invalid path (which will produce not found error)
  2. Bind a method to @error event

What is expected ?

The method should run

What is actually happening?

Not running

Additional comments?

It's working fine when using Vue directly.

This bug report is available on Nuxt community (#c9021)
bug-report

Most helpful comment

You are not getting error event probably because returned content is an actual image (even though response is 404):

content-length: 43
content-type: image/gif

And it's probably related to feature mentioned in #5483 (serve-placeholder)

All 6 comments

You are not getting error event probably because returned content is an actual image (even though response is 404):

content-length: 43
content-type: image/gif

And it's probably related to feature mentioned in #5483 (serve-placeholder)

As @rchl says this behavior cause by the server-placeholder.

First i comment out the code and start my local nuxt.js cli , the error event will be fire .

And then i cancel comment out the code, add { dist: {}, static: { skipUnknown: true } } to my nuxt.config.js, the error event will be fire too.

{ dist: {}, static: { handlers: null } } should work as described in https://github.com/nuxt/serve-placeholder

Right! It worked after generating static html. I'm not using server on production, so need to set that flag on dev mode. Thanks all.

// nuxt.config.js
{
     //...
     render: {
        fallback: false
     }
     //...
}

it works for me.

// nuxt.config.js
{
     //...
     render: {
        fallback: false
     }
     //...
}

it works for me.

None of these suggestions have worked for me. Is there anything else I can do?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vadimsg picture vadimsg  路  3Comments

maicong picture maicong  路  3Comments

msudgh picture msudgh  路  3Comments

surmon-china picture surmon-china  路  3Comments

nassimbenkirane picture nassimbenkirane  路  3Comments