1
我使用的是阿爾戈利亞反應即時搜索,並且我有要求在每次有結果時顯示重疊。React即時搜索:onSearchStateChange獲取返回的匹配數
所以我想通過algolia提供的onSearchStateChange函數來處理它。但我仍然困惑從哪裏獲得總點擊。我已經有了一個想法,就像使用通過jquery提取數字顯示的結果一樣。但我不想這樣做。有沒有其他方式可以建議?
onSearchStateChange(nextState) {
//must get the number of total hits.
nextState = cleanDeep(nextState);
let filters = transformer(nextState);
this.setState({
searchState: nextState,
filters: filters,
searchChanged: true
})
this.sendToAti(filters);
this.addOverlay(); // <--- function that will show the overlay.
location.hash = qs.stringify(nextState);
}