JavaScript模糊查询库:Fuse.js
jopen
12年前
Fuse.js 是一个实现了轻量级模糊查询的 JavaScript 库。
浏览器支持:
- Chrome
- Safari 4+
- Firefox 3.5+
- IE 6,7,8,9+
- Opera 10.6+
- Mobile Safari (iOS 4+)
var options = { keys: ['author', 'title'] } var f = new Fuse(books, options); var result = f.search('brwn'); // Output: ==> [{ id: 2, title: 'The DaVinci Code', author: 'Dan Brown' },{ id: 3, title: 'Angels & Demons', author: 'Dan Brown' }]; // List of the items