当前位置:网站首页>How SAP Spartacus redefines login component
How SAP Spartacus redefines login component
2022-07-25 01:04:00 【Hua Weiyun】
First, in a standard Storefront On , To find the Component Of selector To find the Component name :LoginComponent

And then find the Component The path of , be located feature-libs Below user In module :
feature-libs\user\account\components\login\login.component.ts
Within this module , Found its connection with CMS Component LoginComponent One to one correspondence of :
In my own Storefront Project package-lock.json In the document , Found version number :3.4.3

Create a new one Component, Extended standard LoginComponent:

In my AppModule in , take CMS LoginComponent Map to my extended ExtLoginComponent Go to :


The final runtime effect :
Be careful : If in my expansion Component in , Import from this path LoginComponent:
import { LoginComponent } from ‘@spartacus/user/account/components/login/login.component’;
False report :

ERROR in ./src/app/loginExtension/extLogin.component.ts
Module not found: Error: Can’t resolve ‘@spartacus/user/account/components/login/login.component’ in ‘c:\Code\SPA\strange\mystore\src\app\loginExtension’
The correct path is :
import { LoginComponent } from ‘@spartacus/storefront’;
demand
How to find the exact code location that triggers the network request ?

from initiator View the call stack context in , There is no clue .

Find the name of the control that triggered the network request selector:cx-register

stay Storefront TypeScript I can't find it in the source code :
Generated in compilation JavaScript Search inside cx-register: Found three places

Only direct view SAP Spartacus Source code :cx-register Corresponding RegisterComponent, It's defined in user-profile-components.module.ts in :

Finally found RegisterComponent Other dependencies in :
such as :
- userRegister:UserRegisterFacade
- globalMessageService:GlobalMessageService
- fb:FormBuilder
- router:RoutingService
These dependencies , In the compilation of for In the runtime code , Can see :
These dependencies are used as another module Be inducted into .
I can't see these module In the way of JavaScript Code ?
Search directly RegisterComponent, There are too many results 200 Multiple matches .

Try another way :
eureka :

So the conclusion is ,TypeScript Compiled into JavaScript Source code , Running at Chrome You can still find it in developer tools .
边栏推荐
- Codeworks round 650 (Div. 3) ABCD solution
- Fabric. JS centered element
- Batchinsert avoid inserting duplicate data ignor
- Login and payment arrangement in uniapp
- ASP rs.open SQL, Conn, what does 3, 1 stand for in 3,1?
- record
- Number of palindromes in question 5 of C language deduction (two methods)
- Breederdao's first proposal was released: the constitution of the Dao organization
- Invitation letter | "people, finance, tax" digital empowerment, vigorously promote retail enterprises to achieve "doubling" of economies of scale
- Prosci 14-3-3 (phosphate ser58) antibody instructions
猜你喜欢

What are the functions of rank function

Summary of MATLAB basic grammar

Prosci 14-3-3 (phosphate ser58) antibody instructions

Introduction to thread pool

Pursue and kill "wallet Assassin" all over the network

The current situation of the industry is disappointing. After working, I returned to UC Berkeley to study for a doctoral degree

Specificity and five applications of Worthington alcohol dehydrogenase

How to empty localstorage before closing a page

BisinessCardGen

自动化测试系列-Selenium三种等待详解
随机推荐
Financial RPA robot enables enterprises to open a new era of intelligence
MySQL的最左前缀原则
C language force buckle the flipped number of question 7. Violence Act
Codeworks round 650 (Div. 3) ABCD solution
[performance optimization] MySQL common slow query analysis tools
Several states of the process
Vegetable greenhouses turned into smart factories! Baidu AI Cloud helps Shouguang, Shandong build a new benchmark for smart agriculture
Latex notes
Worthington cytochrome c digestion study carboxypeptidase B scheme
Screenshot of Baidu map
If in ython__ name__ == ‘__ main__‘: Function and principle of
record
C # "learning code snippet" - recursively obtain all files under the folder
Redis管道技术/分区
What are the functions of rank function
7.15 - daily question - 408
Latest information of 2022 cloud computing skills competition
Prosci 14-3-3 (phosphate ser58) antibody instructions
How to use measurement data to drive the improvement of code review
Multi species tissue slide prosci pancreatic tissue solution