Communitymcdoh提出了一个问题:Extending the defaults of a Model superclass in Backbone.js,或许与您遇到的问题类似。
回答者ScottyJCorcuera给出了该问题的处理方式:
The problem is that Inventory.prototype.defaults
and Extended.prototype.defaults
has the same reference, because you have not override the reference.
So you can do this in 2 ways, maybe more but i only found this 2:
Edit: The first example is incorrect (see comments); please refer to the second.
--- ----------------- - ------------------ --------- - -------- - --- ---------------------------------------------- ------------------------------
or
--- ----------------- - ------------------ --------- ----------------------------------------- ---------- - ---
I think the first looks cleaner.
希望本文对你有帮助,欢迎支持JavaScript中文网
来源:JavaScript中文网 ,转载请注明来源 本文地址:https://www.javascriptcn.com/post/26275