2017-08-14 71 views
1

我使用的聚合物-2和試圖從URL queryParams後去除,但如果我打127.0.0.1:8081/listing?q=madrid然後將其重定向到127.0。 0.1:8081 /列表並正在從URL中刪除查詢參數。QueryParams正在重新加載頁面

其實我在主頁有一個搜索表單,填充完成後我想要去上市頁面,我用window.history.pushStatewindow.dispatchEvent(new CustomEvent('location-changed'))來傳遞參數。它的工作正常,但如果我重新加載頁面,然後所有queryParams正在消失,只有path存在。我app-locationapp-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預防?

回答

0

這是一個鐵定位元素的錯誤。

要解決此問題,請修改paramsObject屬性(在iron-location/iron-query-params.html中),直到bug修復。

目前的性質是這樣的:

paramsObject: { 
    type: Object, 
    notify: true, 
    value: function() { 
     return {}; 
    } 
    }, 

刪除值:

value: function() { 
    return {}; 
} 

最後它看起來像:

paramsObject: { 
    type: Object, 
    notify: true, 
    }, 

我看到了這個bug早已拉入請求,idk何時合併。