预先输入空模板不起作用 [英] typeahead empty template not working

查看:27
本文介绍了预先输入空模板不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在像这样设置预先输入:

I am setting up typeahead like so:

       $this.typeahead({ 
            prefetch: $this.data('url-prefetch'), 
            templates: { 
                empty: 'No matching files found' 
            } 
        })

预取工作正常,但在没有匹配项时不显示空模板.

The prefetch is working fine but the empty template is not displayed when there are no matches.

推荐答案

致遇到此问题的任何人:

To whoever comes across this issue:

如果选项中有{async:true},空"模板将不会显示

"Empty" template will not show up if you have {async:true} in the options

$this.typeahead({
  async: false,
  prefetch: $this.data('url-prefetch'), 
  templates: { 
    empty: 'No matching files found' 
  } 
});

这篇关于预先输入空模板不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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