1
我使用的聚合物-2和试图从URL queryParams
后去除,但如果我打127.0.0.1:8081/listing?q=madrid然后将其重定向到127.0。 0.1:8081 /列表并正在从URL中删除查询参数。QueryParams正在重新加载页面
其实我在主页有一个搜索表单,填充完成后我想要去上市页面,我用window.history.pushState
和window.dispatchEvent(new CustomEvent('location-changed'))
来传递参数。它的工作正常,但如果我重新加载页面,然后所有queryParams
正在消失,只有path
存在。我app-location
和app-route
是
<app-location
route="{{route}}"
url-space-regex="^[[rootPath]]
query-params="{{queryParams}}"">
</app-location>
<app-route
route="{{route}}"
pattern="[[rootPath]]:page"
data="{{routeData}}"
tail="{{subroute}}">
</app-route>
<app-route
route="{{subroute}}"
pattern="/:view"
data="{{locationRoute}}">
</app-route>
我的铁页面元素
<iron-pages
selected="[[page]]"
attr-for-selected="name"
fallback-selection="view404"
role="main">
<home name="home"></home>
<listing name="listing"></listing>
<listing name="refine"></listing>
<detail name="detail"></detail>
<vrs-view404 name="view404"></vrs-view404>
</iron-pages>
哪里是我的错误,以及如何从URL失去queryParams
预防?