meteor easy search
1.0.0
Easy Search 是一个简单而灵活的解决方案,用于向您的 Meteor 应用程序添加搜索功能。使用 Blaze 组件 + Javascript API 开始。
import { Index , MinimongoEngine } from 'meteor/easy:search'
// On Client and Server
const Players = new Mongo . Collection ( 'players' )
const PlayersIndex = new Index ( {
collection : Players ,
fields : [ 'name' ] ,
engine : new MinimongoEngine ( ) ,
} )
// On Client
Template . searchBox . helpers ( {
playersIndex : ( ) => PlayersIndex ,
} ) ;
< template name =" searchBox " >
{{ > EasySearch.Input index=playersIndex }}
< ul >
{{#EasySearch.Each index=playersIndex }}
< li > Name of the player: {{name}} </ li >
{{/EasySearch.Each}}
</ ul >
</ template >
查看可搜索排行榜示例或查看当前文档(v1 文档)以获取更多信息。
cd /path/to/project
meteor add easy:search