且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

关于 SAP Spartacus 注入服务 UserAccountService 和 facade 的问题

更新时间:2022-08-28 19:29:31

ssue 里提到的 UserAccountService:

关于 SAP Spartacus 注入服务 UserAccountService 和 facade 的问题实现了 UserAccountFacade.

如果直接导入 UserAccountService:

import { UserAccountService } from ‘@spartacus/user/account/core’;报错:关于 SAP Spartacus 注入服务 UserAccountService 和 facade 的问题解决方案:

import { UserAccountFacade } from ‘@spartacus/user/account/root’


The actual services are lazily loaded, so that only when you use it, the additional js will be loaded. This requires however that you inject the facade instead, so that we can do the magic of loading the service lazily.


需要注入 facade,让 facade 执行延迟加载。