【发布时间】:2019-08-30 06:07:25
【问题描述】:
我知道这是一个非常基本的问题,但我仍然无法理解这个非常简单的问题。在这里。
使用 vuejs-router,我尝试路由到页面 Custom.vue。
自定义.vue
<template>
<div>
<h1>Hello User</h1>
</div>
</template>
<script>
export default {
name: 'Custom'
}
</script>
在 routes 变量中,我配置了如下路径。
const routes = [
{ path: '/', component: HelloWorld },
{ path: '/home', component: Custom },
]
问题:现在发生的痛苦事情是,当我尝试使用 localhost:8081/#/home 访问页面时,页面加载正确,但使用 localhost:8081/home 时却没有。
【问题讨论】:
-
您需要启用历史模式 + 设置基本服务器入口点:router.vuejs.org/guide/essentials/…
-
非常感谢!
标签: vue.js vue-router