我正在使用 polymer 入门套件,其中使用 page.js
用于路由。 hashbang
page
选项设置为 true
在routing.html
// add #! before urls
page({
hashbang: true
});
当链接如<a href="/products/productname"></a>
时单击后,#!
添加后,生成的 url 如下所示:http://localhost:3000/#!/products/productname
但是当在新的浏览器选项卡中打开链接时,它们看起来像这样 http://localhost:3000/products/productname
。我怎样才能拥有#!
在新选项卡中打开链接时添加?
最佳答案
你必须写
<a href="#!/products/productname"
在每个 href 中
关于javascript - 在新选项卡中打开链接时,使用 page.js 的 Polymer Routing 不会将 hashbang 添加到 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30925003/