Algolia instantsearch.js回调函数 [英] Algolia instantsearch.js callback function
问题描述
我正在使用Algolia instantsearch.js 作为我的网站搜索。
I am using Algolia instantsearch.js as my site search.
设置过程非常简单明了,包括.js和.css文件,创建模板,然后使用 app()
函数创建一个.js文件,用于设置我的应用程序(appId,apiKey,indexName)和小部件。
The setup process was rather easy and straightforward, including .js and .css files, creating templates and then create one more .js file with app()
function for setting up my app (appId, apiKey, indexName) and widgets.
我需要的是每次搜索功能运行时都会执行的功能,最好是在显示命中后立即执行。
What I need is a function that will execute each time a search function ran, preferably right after the hits are shown.
也许有一个小部件?
谢谢!
推荐答案
您可以收听 render 事件#eventsrel =nofollow>这里,这是在呈现所有小部件后触发的事件:
You can listen the render
event like described here, it's an event triggered once all widgets have been rendered:
var search = instantsearch({...});
search.on('render', function() {
// FIXME
});
您还可以创建自定义小部件并在 render
方法中执行特定操作。
You could also create a custom widget and do a specific action in the render
method.
这篇关于Algolia instantsearch.js回调函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!