https://github.com/meilisearch/MeiliSearch
https://docs.meilisearch.com/learn/getting_started/quick_start.html#download-and-launch
先申请一个来测试一下
申请链接https://sandbox.meilisearch.com/
vue项目里
npm install meilisearch
import { MeiliSearch } from 'meilisearch'
methods
addSearchDoc(){ const client = new MeiliSearch({ host: 'https://cozy-mauve-collie-hahb.sandbox.meilisearch.dev', apiKey: 'hUJzYmZbrILvGlTvCrbUBHlhuYpzzZas' }) // An index is where the documents are stored. const index = client.index('books') const documents = this.mbook; console.log('mbook',this.mbook) index.addDocuments(documents).then(res =>{ console.log('addDocuments res',res) }) }
mounted
setTimeout(()=>{ this.addSearchDoc() },1000)
computed
computed: { mbook:function(){ console.log('this.books',this.books) return this.books; } },
转载请注明:有爱前端 » vue中小试MeiliSearch轻量搜索引擎