在suitecommerce核心代码中有一个视图OrderWizard模块视图。它有类似于下面的方法(不是确切的代码,不是为专有问题粘贴)。我已经创建了扩展并从扩展中调用了 OrderWizard 的方法。
**setAddr: function(xxx, xxxx) {
this.model.setAddress(xxx, xxxx, xxxx);
return this;
}
renderView: function() {
if (!this.isActiveVal()) {
return this;
}
}**
Extension class:
**define(
'TEST.PaymentValidation.PaymentValidation'
, [
'OrderWizard.xxxxx.xxxxx'
]
, function (
OrderWizardAddress
)
{
'use strict';
return {
mountToApp: function mountToApp (container)
{
_.extend(OrderWizardAddress.prototype,
{
setAddressExt: function setAddressExt() {
{
OrderWizardAddress.prototype.setAddr.apply(this, arguments);
}
}
});
_.extend(OrderWizardAddress.prototype,
{
renderExt: function renderExt() {
{
OrderWizardAddress.prototype.renderView.apply(this, arguments);
}
}
});
OrderWizardAddress.prototype.setAddressExt();
OrderWizardAddress.prototype.renderExt();
}
};
});**
调用 renderExt 方法时,无法读取未定义的属性“isActiveVal”类型错误:无法读取未定义的属性“isActiveVal”。尽管 isActiveVal 在 OrderWizard 视图中可用。
调用 setAddressExt 时,我得到“这是未定义的”。
有人可以帮助我在这里做错了什么。从扩展中调用suitecommerce核心代码方法的最佳方法是什么。我想我没有传递OrderWizard视图的实际上下文(.apply(this)。