我需要在 Framework7 中实现自定义搜索

Gan*_*mar 5 search jquery html-framework-7

我有 2 组数组,第 1 组是整个数组组,第 2 组是前 10 个数组(第二组是显示在 UI 中)。我已经实现了对列表视图的搜索。

但我需要从整个数组列表中进行搜索。

<form class="searchbar searchbar-init" data-search-list=".list-block-search" data-search-in=".item-title" data-found=".searchbar-found" data-not-found=".searchbar-not-found">
                    <div class="searchbar-input">
                       <input type="search" placeholder="Search">
                       <a href="#" class="searchbar-clear"></a>
                    </div>
                    <a href="#" class="searchbar-cancel">Cancel</a>
                 </form>
Run Code Online (Sandbox Code Playgroud)

jon*_*bar 5

您需要使用customSearch设置为的选项来初始化搜索栏true。请参阅:http : //framework7.io/docs/searchbar.html

以下是自定义搜索的入门示例:

var searchBar = myApp.searchbar('.searchbar', {
    customSearch: true,
    onSearch: function(s) {
        console.log('Searching', s);
    },
    onClear: function(s) {
        console.log('Clearing', s);
    }
});
Run Code Online (Sandbox Code Playgroud)