【发布时间】:2018-07-17 22:40:13
【问题描述】:
我是 vuejs 的新手。对于我的 Vuejs 应用程序,在运行“npm run build”之后,我无法在 Web 托管服务器中访问 '/foo/apple' 之类的 URL。它显示错误 404 我正在使用 HTML5 历史模式 (https://router.vuejs.org/guide/essentials/history-mode.html#example-server-configurations),并且我在 dev-server.js 中实现了如下所示的“connect-history-api-fallback”:
const express = require('express')
const app = express()
app.use(require('connect-history-api-fallback')())
我的路由器/index.js
export default new Router({
mode: 'history',
{
path: '/Product',
name: 'Product',
component: Product,
},
{
path: '/Product/kraftbag',
name: 'Kraftbag',
component: Kraftbag
},
});
我的网站http://americandunnage.n55lwi.info/。 我找了很多关于这个问题的帖子,但我仍然可以找到解决方案。
【问题讨论】:
标签: vue.js server routing vuejs2 vue-router