2016-09-21 99 views
1

我已经安装了聚合物入门工具包,一旦我加载入门工具包,每件东西都得到正确加载和url看起来像http://127.0.0.1:8887/然后,一旦我点击任何视图页面变得打开和URL更改为http://127.0.0.1:8887/view1,但如果我现在重新加载浏览器,而不是显示相同的页面,它显示条目未找到error.i已尝试通过互联网搜索解决方案,但我没有找到一个,我该怎么做才能解决它。重新加载聚合物错误

+0

是否使用由聚合物CLI或其他web服务器'聚合物serve'命令? – Hunex

+0

即时通讯使用铬网络服务器 – aries12

回答

1

当您刷新页面(http://127.0.0.1:8887/view1)时,您向服务器请求view1资源,但服务器找不到它,因为没有。该路径(.../view1)仅被聚合物应用本身识别,而不是服务器。

尝试在路径中使用散列。将use-hash-as-path属性添加到主页面内的app-location元素。

因此,它应该是这样的:

<app-location route="{{route}}" use-hash-as-path></app-location> 

编辑

这是不够的,添加use-hash-as-path财产。您还需要稍微更改菜单项中的href

href="/view1"href="#/view1"

代码更多的细节:

<app-location route="{{route}}" use-hash-as-path></app-location> 
<app-route 
    route="{{route}}" 
    pattern="/:page" 
    data="{{routeData}}" 
    tail="{{subroute}}"></app-route> 

<app-drawer-layout fullbleed> 

    <!-- Drawer content --> 
    <app-drawer> 
    <app-toolbar>Menu</app-toolbar> 
    <iron-selector selected="[[page]]" attr-for-selected="name" class="drawer-list" role="navigation"> 
     <a name="view1" href="#/view1">View One</a> 
     <a name="view2" href="#/view2">View Two</a> 
     <a name="view3" href="#/view3">View Three</a> 
    </iron-selector> 
    </app-drawer> 
    ... 
</app-drawer-layout> 
+0

编辑我的答案,因为解释不完全正确,解决方案保持不变。 – Hunex

+0

尝试添加使用哈希作为路径其不工作.. – aries12

+0

我需要链接到页面的任何组件? – aries12