我正在localhost开发上测试vue-router的历史记录模式,当我尝试直接访问URL http://localhost:8080/map/2
时遇到错误。当我通过某种$router.push
到达URL时,它的行为正确。我想知道是什么原因引起的。
router / index.js
import Vue from "vue"
import Router from "vue-router"
const PublicMap = () => import("@/components/PublicMap/index.vue")
Vue.use(Router)
var routes = [
{
component: PublicMap,
name: "map",
path: "/map/:_id",
},
]
export default new Router({
routes,
mode:
"history"
})
错误:
Uncaught SyntaxError: Unexpected token <