---- AI试用 ---域名问题某些图片和js资源无法访问,导致一些代码实例无法运行!(代码里gzui.net换成momen.vip即可)

vue中小试MeiliSearch轻量搜索引擎

前端开发 蚂蚁 1461℃ 0评论

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轻量搜索引擎

喜欢 (0)or分享 (0)