使用Vuetify设置nuxt项目.其中一个页面使用client-only
(no-ssr
)组件.在开发过程中,如果该组件出现错误,我会被重定向到默认错误页面,这会阻止我使用Vue devtools判断变量和组件.
我觉得它应该非常简单,但我找不到一种方法来禁用这种自动重定向行为.所以我想我的问题是如何禁用nuxt默认错误重定向?
使用Vuetify设置nuxt项目.其中一个页面使用client-only
(no-ssr
)组件.在开发过程中,如果该组件出现错误,我会被重定向到默认错误页面,这会阻止我使用Vue devtools判断变量和组件.
我觉得它应该非常简单,但我找不到一种方法来禁用这种自动重定向行为.所以我想我的问题是如何禁用nuxt默认错误重定向?
不能从nuxt配置中禁用<nuxt-error>
渲染.
另一种方法是对nuxt渲染进行如下攻击:
1/ open the file ./node_modules/@nuxt/vue-app/template/components/nuxt.js
2/ go to the render(h)
method
3/ remove the error condition to always show the component:
render (h) {
// HACK TO SKIP ERROR
this.nuxt.err = false
// if there is no error
if (!this.nuxt.err) {
// Directly return nuxt child
return h('NuxtChild', {
key: this.routerViewKey,
props: this.$props
})
}
// ...
}
每次安装npm或yarn后,上面文件中的hack将被覆盖.