【发布时间】:2019-01-10 03:35:32
【问题描述】:
我想搜索我的 firebase 数据库,以便用户能够找到他们正在搜索的产品。
目前我正在将数据属性 this.searchText 与 firebase 中的 product.title 进行匹配。
return str.filter((product) => {
return product.title.match(textSearch)
})
我对此有疑问:
如果数据库包含 1000 个产品,则过滤网站上的产品是没有意义的,而是进行有效的查询,例如:
firebase.database.ref('products').containing('leather shoe')
我只是找不到合适的解决方案。
【问题讨论】:
-
For 1.:由于代码相同(除了字符串),没有办法给出任何提示。您应该提供一些示例数据和使用过滤器的周边方法。
-
当然......在等待答案的同时,我终于找到了第一个问题的解决方案(监督旧方法)。我现在已经编辑了问题。
-
如何从 firebase 获取产品列表?
标签: javascript firebase vue.js vuefire