Algolia Instantsearch.js 回调函数 [英] Algolia instantsearch.js callback function

查看:19
本文介绍了Algolia Instantsearch.js 回调函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 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.

也许有一个widget可以做到这一点?

Maybe there is a widget for that?

谢谢!

推荐答案

你可以像描述的那样监听 render 事件 此处,这是在所有小部件都呈现后触发的事件:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆