我有搜索页面,我使用$router.replace({params: filters});
更新了包含更新过滤器值的查询字符串。但是当我使用客户端导航导航到另一个页面的过滤器页面时$router.replace()
正在中止。这是我的代码:
组件
<filter-section
@filterSearch="filter"
@toggleView="handleToggleView"
:currentlySelected="view_type"
@mapViewMounted="loadMarkers" />
方法
async filter(filters) {
this.listLoading = true;
this.APPLY_SEARCH_FILTER(filters);
// changes the query parameters in the url to be in sync with the current filters
this.$router.replace({query: filters}, () => {
// when the page is refreshed and the page is server rendered
// then this is working fine
console.log('Route replace complete');
}, () => {
// when navigated to this page using client side
// routing the route replace is being aborted
console.log('Route replace abort');
});
let { data } = await this.$api.Search.groups(filters);
let groups = data.data.groups;
let meta = data.data.meta;
this.STORE_SEARCH_RESULTS({
groups: groups,
meta: meta
});
this.listLoading = false;
this.loadMarkers();
},
我从另一个页面this.$router.push('/search?${searchString}');
转到此页面
我在这里做错了吗?