Aurelia BrowserSync重新加载不适用于所有路由

Aurelia BrowserSync重新加载不适用于所有路由,aurelia,browser-sync,Aurelia,Browser Sync,我正在开发一个aurelia应用程序,这是路由配置 configureRouter(config, router) { config.title = 'Title'; config.map([ {route: [''], name: 'home', moduleId: 'home', nav: false, title: 'home'}, {route: 'customers', name: 'customers', moduleId: './pages/

我正在开发一个aurelia应用程序,这是路由配置

configureRouter(config, router) {
    config.title = 'Title';
    config.map([
      {route: [''], name: 'home', moduleId: 'home', nav: false, title: 'home'},
      {route: 'customers', name: 'customers', moduleId: './pages/customers/customers', nav: false, title: 'customers'},
      {route: 'customers/:id', name: 'custDetail', moduleId: './pages/customers/custDetail', nav: false, title: 'customer Details'}
    ]);
    config.options.pushState = true;
    this.router = router;
  }
在主页上单击一个按钮,我会调用

 this.router.navigateToRoute('customers', {tags: this.tags});
如果我修改customers/:id页面,则浏览器重新加载不起作用,显示错误

无法获取/customers/2

这就是它的工作原理吗


谢谢

这里的问题是您的服务器没有配置为使用
pushState
,这是一种避免使用url哈希进行路由的特殊模式。(正如我们在评论中所讨论的),下面这一行是导致问题的原因

// this should only be used when you have a pushState enabled server
config.options.pushState = true;

您可以将其删除或设置为false。

这里的问题是您的服务器没有配置为使用
pushState
,这是一种特殊模式,可以避免使用url哈希进行路由。(正如我们在评论中所讨论的),下面这一行是导致问题的原因

// this should only be used when you have a pushState enabled server
config.options.pushState = true;

您可以将其删除,也可以将其设置为false。

因此,您遇到的问题是,当您希望位于
localhost:9000/#/customers/2
时,您位于
localhost:9000/#/customers/2
。根据你的代码,我不知道为什么。当您修改
custdail
页面时,我不完全理解您所处的页面。我试图将config.options.hashChange=false;但是当我尝试localhost:9000/#/customers/2i删除config.options.pushState=true这一行时,它会转到主页,现在一切正常。它显示的是#现在,那么我们应该什么时候使用上面的线?啊!我没注意到你在里面有按钮状态!就是这样。所以,你遇到的问题是,当你想在
localhost:9000/#/customers/2
时,你却在
localhost:9000/#/customers/2
上。根据你的代码,我不知道为什么。当您修改
custdail
页面时,我不完全理解您所处的页面。我试图将config.options.hashChange=false;但是当我尝试localhost:9000/#/customers/2i删除config.options.pushState=true这一行时,它会转到主页,现在一切正常。它显示的是#现在,那么我们应该什么时候使用上面的线?啊!我没注意到你在里面有按钮状态!就是这样。那么我需要在生产中设置它为真吗?还是让它假?让它假。它是那种“大多数用户不需要担心它”的东西。那么我需要在生产中设置它为真吗?还是让它假?让它假。它是一种“大多数用户不需要担心”的东西。