我正在使用Dojo内存存储(dojo / store / Memory)。我想基于通配符查询来检索项目,但查询方法似乎不支持通配符。即给出以下项目:

{ id: "apple", details: "fruit" }
{ id: "applemac", details: "computer" }
store.query({ id: "apple" })按预期返回第一行,但是store.query({ id: "apple*" })不返回任何内容。

有谁知道是否可以使用通配符,如果可以,如何使用?

谢谢

最佳答案

您可以使用RegExp对象进行通配符查询

store.query({id:new RegExp("apple*")})

Here's a JSFiddle

07-24 09:44
查看更多