一个简单的workaround - 如何使用SAP Spartacus中的private API

Disclaimer: The private API of Spartacus should not be used in general. It may change at any time without any warning. You can use the following workaround on your OWN RISK. It might result in breaking your code after upgrading to any next version.


具体做法

Open file node_modules/@spartacus/xxxxx/spartacus-xxxxx.d.ts and find the exported alias name for the class, prefixed with symbol ɵ:


export { SomeClass as ɵxyz } from '..........';

1

Then you can use the alias in your application, for example to extend the class behavior:

一个简单的workaround - 如何使用SAP Spartacus中的private API

WARNING: the ɵ-alias might change in any next release of Spartacus without any warning. It’s not a part of the public API.

如下图所示:

一个简单的workaround - 如何使用SAP Spartacus中的private API

上一篇:c++ GDI 中SelectObject使用方法和注意事项


下一篇:面象对象设计6大原则之五:依赖倒置原则