Say*_*Das 5 vue.js vue-router nuxt.js
我有搜索页面,我正在其中使用更新后的过滤器值更新查询字符串$router.replace({params: filters});。但是,当我使用客户端导航从另一个页面导航到过滤器页面时,导航$router.replace()将被中止。这是我的代码:
成分
<filter-section
@filterSearch="filter"
@toggleView="handleToggleView"
:currentlySelected="view_type"
@mapViewMounted="loadMarkers" />
Run Code Online (Sandbox Code Playgroud)
方法
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();
},
Run Code Online (Sandbox Code Playgroud)
我从另一个页面路由到这个页面,就像这样this.$router.push('/search?${searchString}');
我在这里做错了什么吗?
| 归档时间: |
|
| 查看次数: |
5508 次 |
| 最近记录: |