【问题标题】:Vue.js history mode Custom 404 PageVue.js 历史模式自定义 404 页面
【发布时间】:2018-04-03 06:29:56
【问题描述】:

我用 Vue.js 做了一个管理模板的应用 网址:http://vuejsadmin.com/

一切似乎都很好。但是我无法在我的 VPS 主机上配置 404 页面。因为如果我去像http://vuejsadmin.com/components/buttons这样的直接URL 然后显示 nginx 404。我想显示我的模板的 404 页面。

如何使用模板的 404 页面对其进行自定义?

谢谢

【问题讨论】:

    标签: webpack vue.js vuejs2 vue-router


    【解决方案1】:

    在您的路由所在的文件中,您需要使用“*”通配符为您的 404 组件定义一个路径:

    ...
    routes: [
      // Other paths and their children...
      ...
      // Any other paths must return your 404Component now
      { path: '*', component: 404Component },
    ]
    

    【讨论】:

    猜你喜欢
    • 2018-12-09
    • 2018-11-16
    • 2010-11-04
    • 2012-10-26
    • 2011-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多