The models that are most frequently customized are currently placed in @spartacus/core.
The following is an example of module augmentation
on
the ConsentTemplate model:
假设我想扩展Spartacus core里的标准interface:
ConsentTemplate
首先从Spartacus core里导入:
import { ActiveCartService, CartAddEntrySuccessEvent, CmsConfig, Config, ConfigModule, ConsentTemplate, EventService } from '@spartacus/core';
然后使用如下语法扩展一个新的字段documentUrl:
declare module '@spartacus/core' {
interface ConsentTemplate {
documentUrl?: string;
}
}
最后的效果:一个新的 documentUrl
属性被添加了。
而关于SAP Spartacus 前台控制逻辑即业务的扩展,示意图如下:
更多Jerry的原创文章,尽在:“汪子熙”: