How make custom design page 404 in nuxt beta?

Viewed 39

I try to find where it is official docs, but did`t.

https://v3.nuxtjs.org/

I created error.vue in folder layouts, but it did`t worked.

layouts
--default.vue
--error.vue
1 Answers

I don't know how to do it correct, but I did that.

// add plugins\page.404.js
// nuxt.confin  plugins: [ '~/plugins/page.404' ]
    ],
import { defineNuxtPlugin } from '#app';
import { useRouter } from '#imports'
import NotFoundComponent from "~/components/pages/error.vue";

export default defineNuxtPlugin(() => {
    const router = useRouter();
    const page404 = { path: '/:pathMatch(.*)', component: NotFoundComponent };
    router.addRoute(page404);
});

Related