问题描述
我正在使用聚合物入门套件,该套件使用page.js
进行布线. hashbang
page
选项在routing.html
I am using polymer starter kit which uses page.js
for routing. The hashbang
page
option is set to true
in routing.html
// add #! before urls
page({
hashbang: true
});
当单击诸如<a href="/products/productname"></a>
之类的链接时,将添加#!
,并且所得到的URL如下所示:http://localhost:3000/#!/products/productname
,但是当在新的浏览器选项卡中打开链接时,它们的外观类似于此http://localhost:3000/products/productname
.在新标签页中打开链接时,如何添加#!
?
when links such as <a href="/products/productname"></a>
are clicked, the #!
is added and the resulting url looks like this: http://localhost:3000/#!/products/productname
but when the links are opened in a new browser tab, they look like this http://localhost:3000/products/productname
. How can I have the #!
added when links are opened in new tab?
推荐答案
您必须编写
<a href="#!/products/productname"
每个您的href
这篇关于当在新标签页中打开链接时,使用page.js的Polymer Routing不会在URL上添加hashbang的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!