我周围搜索,但不幸的是,还没有找到这个问题的重复。在JavaScript中,如何继承和扩展正在继承的方法?
文件1:
var Graph = Backbone.View.extend({
move: function() {
//some stuff
}, //more stuff
})
文件2:
define ([ './graph.js' ]), function(graph) {
var SubGraph = Backbone.View.extend({
// this file needs to inherit what is within the move method but extend it to include other stuff
})
你如何在不破坏现有的延长继承的属性?
你能提供更多关于你的期望的细节吗? – Lucero 2012-07-20 21:43:19
我认为你可以做'var SubGraph = Graph.extend(...',为了设置继承,但我不确定...(我过去只有一次处理骨干) – 2012-07-20 21:45:24