我正在阅读can.Construct.extend API文档,并偶然了解到CanJS http://canjs.com/docs/can.Construct.extend.html .I知道can.Construct创建构造函数,但无法理解can.Construct.extend的使用。有人能解释一下can.Construct和can.Construct.extend的区别吗?如果你能用一些例子来解释,那就太棒了。
提前谢谢
发布于 2014-03-04 06:24:00
两者在功能上是相同的。在内部,can.Construct()
及其所有派生类都调用extend()
。这完全取决于风格偏好:can.Construct()
或<something derived from can.Construct>()
略短一些,但您可能会将其与创建新实例的new <something derived from can.Construct>()
混淆,而使用<something derived from can.Construct>.extend()
则是明确的
https://stackoverflow.com/questions/22163567
复制相似问题