【发布时间】:2013-12-05 12:05:05
【问题描述】:
我会将一个项目从 Mootools 迁移到 Prime,但现在我遇到了“setOptions”问题,该函数无法像在 Mootools 中那样工作,其中 options 对象将通过超级原链合并并包含所有钥匙。
var A = prime({
options: {
name: 'image',
tag: 'span',
src: '/'
},
constructor: function(options){
this.setOptions(options);
},
getOptions: function(){
console.log(this.options);
}
});
var B = prime({
inherits: A,
options: {
name: 'B'
},
some: function(){
return;
}
});
mixin(A, Options);
mixin(B, Options);
var b = new B({
tag: 'div'
});
b.getOptions(); //the result should be: {name: "B", tag: "div", src: "/"} but is {name: "B", tag: "div"}
感谢您的任何想法。
【问题讨论】:
标签: javascript class mootools options