put和add方法的第二个参数{directives}是什么? 有谁知道你可以放在这里?
https://github.com/SitePen/dstore/blob/master/docs/Store.md
put(object, [directives]) This stores an object. It can be used to update or create an object. This returns a promise that may resolve to the object after it has been saved.
add(object, [directives]) This creates an object, and throws an error if the object already exists. This should return a promise for the newly created object.
答案 0 :(得分:2)
正如GibboK所提到的,Directives是包含有关创建和更新存储对象的信息的对象。
有效的属性是:
id - String|Number?
- id用作新对象的标识。仅在add()
中使用。
beforeId - String?
- 要在属性中设置id之前放置的新创建或更新对象。
overwrite - Boolean?
- 表示对象应该或不应该覆盖现有对象。
文档可以在代码" dstore \ Store.js"中找到。 Store.PutDirective。还有另一个未使用的属性parent
。
dstore\Rest
的指令具有附加属性header - Object?
,其中包含请求的标头信息。
您可能需要查看商店的类型,您正在使用它来获取您可以传递的有效对象的完整文档[directives]
。
希望这有用。
答案 1 :(得分:1)
指令传递给put()和add()处理程序以指导更新 和存储对象的创建。
不幸的是,关于directives
的文档非常有限。