重新加载路线不适用于 Vue JS

Reload routes not working on Vue JS

我刚刚在 Vue js 2 上构建了我的作品集并上线了。 我有三种看法。当我重新加载主页视图时它没问题,但在另外两个视图上我有几条错误消息。

Error parsing a meta element's content: ';' is not a valid key-value pair separator. Please use ',' instead.
Work:30 A parser-blocking, cross site (i.e. different eTLD+1) script,
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://website.com' is therefore not allowed access. The response had HTTP status code 403. 

我是第一次上线单页webapp架构。 请问有解决办法吗?

这是路由文件

import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/views/Home'
import Work from '@/views/Work'
import About from '@/views/About'

Vue.use(VueRouter)

export default new VueRouter({
  mode: 'history',
  routes: [
    { path: '/', component: Home },
    { path: '/Work', component: Work },
    { path: '/About', component: About }
  ]
})

查看 Vue Router 网站上的 example configurations。他们经常修复在开发时服务器端发生的问题。

在某些特殊情况下,this trick 将不起作用,例如当您的项目位于您域的子文件夹中时。

为此,您必须添加这些行。将您的 子文件夹名称 替换为

{Your sub folder name}

RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /{Your sub folder name}/index.html [L]

只适用于apache。如果您在 apache 上部署应用程序需要任何帮助,请给我发消息。