Nuxt.js: Is there any way to access nuxt context(error handler) after the page rendered

Created on 12 Jul 2017  路  3Comments  路  Source: nuxt/nuxt.js

I want to route to the error page after running some browser only checkers, is there any way?

This question is available on Nuxt.js community (#c938)

Most helpful comment

HI @ye-will

You can this this.$nuxt.error({ statusCode, message }) inside any Vue components instances on client-side, or from outside of components, you can use:
``js window.onNuxtReady(() => { window.$nuxt.error({ statusCode, message }) }) ```` Example, go to https://nuxtjs.org and open the browser console, then write$nuxt.error({ message: 'Hello', statusCode: 404 })` and press enter :)

All 3 comments

HI @ye-will

You can this this.$nuxt.error({ statusCode, message }) inside any Vue components instances on client-side, or from outside of components, you can use:
``js window.onNuxtReady(() => { window.$nuxt.error({ statusCode, message }) }) ```` Example, go to https://nuxtjs.org and open the browser console, then write$nuxt.error({ message: 'Hello', statusCode: 404 })` and press enter :)

Awesome, thx! @Atinux

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

msudgh picture msudgh  路  3Comments

bimohxh picture bimohxh  路  3Comments

danieloprado picture danieloprado  路  3Comments

jaredreich picture jaredreich  路  3Comments

mattdharmon picture mattdharmon  路  3Comments