vue中小试MeiliSearch轻量搜索引擎

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;
    }
  },
THE END
分享
二维码
打赏
< <上一篇
下一篇>>