0
为什么直接在浏览器上直接输入Aurelia路线不起作用?我已经配置了Aurelia以从URL中删除“#”。当点击网站中的链接时,它运行良好,但是当我尝试直接在浏览器上键入URL时,它只能使用“#”。直接在浏览器上打字时,路线不起作用
这就是这种情况:
随着网站的链接
本地主机/#/路由 - >工作
本地主机/路由 - >工作
打字上的浏览器
localhost /#/ route - > works
本地主机/路由 - >不工作
这是我的配置:
configureRouter(config, router){
config.title = 'Dreampper';
router.baseUrl = "/";
config.options.pushState = true;
var navStrat = (instruction) => {
instruction.config.moduleId = instruction.fragment
instruction.config.href = instruction.fragment
}
config.map([
{ route: 'login', moduleId: './components/account/login', name: 'login', nav: true},
{ route: 'register', moduleId: './components/account/register', name: 'register'},
{ route: '', moduleId: './components/timeline/timeline', name: 'timeline', title: 'Timeline' },
{ route: 'welcome', moduleId: './components/account/welcome', name: 'welcome' },
{ route: ':username', moduleId: './components/profile/profile', name: 'profile', nav: false }
]);
this.router = router;
}
我对index.html中的<base href="/">
。
有人可以帮助我吗?