backbone 中的 clear 和 unset 有什么区别?
What is the diffrence between clear and unset in backbone?
我是backnone的新人,我只是觉得标题很清楚我的问题是什么,但我又问了一遍:
clear和backbone中的unset有什么区别? (两人return一件事)
-unset
从模型中删除属性。
unsetmodel.unset(attribute, [options])
Remove an attribute by
deleting it from the internal attributes hash. Fires a "change" event
unless silent is passed as an option.
-clear
从模型中删除所有属性。
clearmodel.clear([options])
Removes all attributes from the model,
including the id attribute. Fires a "change" event unless silent is
passed as an option.
我是backnone的新人,我只是觉得标题很清楚我的问题是什么,但我又问了一遍:
clear和backbone中的unset有什么区别? (两人return一件事)
-unset
从模型中删除属性。
unsetmodel.unset(attribute, [options])
Remove an attribute by deleting it from the internal attributes hash. Fires a "change" event unless silent is passed as an option.
-clear
从模型中删除所有属性。
clearmodel.clear([options])
Removes all attributes from the model, including the id attribute. Fires a "change" event unless silent is passed as an option.