umi最新版本使用约定式路由404页面出不来,随便输入路由都是空白页面并未渲染404页面。

Created on 23 Jul 2020  ·  4Comments  ·  Source: umijs/umi

如题。
image
image
image

type(bug)

Most helpful comment

鉴于迟迟没有合并PR, 提供本人的解决方法:

  1. 404.jsx 改成 [any].jsx, 保证在生成的路由在最后一项

  2. 覆盖页面属性的 pathundefined, 达到生成的routes里没有path的目的

// [any].jsx

const NoFoundPage = () => <div>not found</div>

// !!!这里覆盖掉 path 的值!!!
NoFoundPage.path = undefined;

export default NoFoundPage;

All 4 comments

bug,有相关的issues 和 PR的

遇到相同的问题 demo 网站 https://llxhzm.xyz:6001

鉴于迟迟没有合并PR, 提供本人的解决方法:

  1. 404.jsx 改成 [any].jsx, 保证在生成的路由在最后一项

  2. 覆盖页面属性的 pathundefined, 达到生成的routes里没有path的目的

// [any].jsx

const NoFoundPage = () => <div>not found</div>

// !!!这里覆盖掉 path 的值!!!
NoFoundPage.path = undefined;

export default NoFoundPage;

Was this page helpful?
0 / 5 - 0 ratings