简体   繁体   English

Algolia instantsearch.js回调函数

[英]Algolia instantsearch.js callback function

I am using Algolia instantsearch.js as my site search. 我使用Algolia instantsearch.js为我的网站的搜索。

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. 设置过程相当简单直接,包括.js和.css文件,创建模板,然后创建一个带app()函数的.js文件,用于设置我的应用程序(appId,apiKey,indexName)和小部件。

What I need is a function that will execute each time a search function ran, preferably right after the hits are shown. 我需要的是每次搜索功能运行时执行的功能,最好是在显示命中后立即执行。

Maybe there is a widget for that? 也许有一个小部件呢?

Thanks! 谢谢!

You can listen the render event like described here , it's an event triggered once all widgets have been rendered: 您可以像这里描述的那样监听render事件,这是在render完所有小部件后触发的事件:

var search = instantsearch({...});
search.on('render', function() {
   // FIXME
});

You could also create a custom widget and do a specific action in the render method. 您还可以创建自定义窗口小部件并在render方法中执行特定操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM