日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

SAP Spartacus B2cStorefrontModule里提供的默认配置

發(fā)布時(shí)間:2023/12/19 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SAP Spartacus B2cStorefrontModule里提供的默认配置 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

實(shí)現(xiàn)代碼:

import { ModuleWithProviders, NgModule } from '@angular/core'; import {provideConfig,provideDefaultConfig,provideDefaultConfigFactory, } from '@spartacus/core'; import { CmsLibModule } from '../cms-components/cms-lib.module'; import { StorefrontConfig } from '../storefront-config'; import { layoutConfig, mediaConfig } from './config/index'; import { defaultCmsContentConfig } from './config/static-cms-structure/default-cms-content.config'; import { StorefrontModule } from './storefront.module';@NgModule({imports: [StorefrontModule,// the cms lib module contains all components that added in the bundleCmsLibModule,],providers: [provideDefaultConfig({pwa: {enabled: true,addToHomeScreen: true,},}),provideDefaultConfig(layoutConfig),provideDefaultConfig(mediaConfig),provideDefaultConfigFactory(defaultCmsContentConfig),],exports: [StorefrontModule], }) export class B2cStorefrontModule {static withConfig(config?: StorefrontConfig): ModuleWithProviders<B2cStorefrontModule> {return {ngModule: B2cStorefrontModule,providers: [provideConfig(config)],};} }

3個(gè)默認(rèn)配置:

layoutConfig

import { LayoutConfig } from '../../layout/config/layout-config';/*** The layout configuration is used to define the overall layout of the storefront.* The configuration includes the following aspects:* - breakpoint layout (AKA screen layout)* - Page sections slot configuration (i.e. header vs footer)* - page template slot configuration (i.e. landing page template vs PDP page template)* - deferred loading configuration** The page slot configurations is directly related to the data in the backend. If you use the* Spartacus sample-data, you will have an aligned setup. However, if you introduce custom page* templates and/or slots, you most likely need to further adjust or replace this configuration.*/ export const layoutConfig: LayoutConfig = {// deferredLoading: {// strategy: DeferLoadingStrategy.DEFER,// intersectionMargin: '50px',// },layoutSlots: {header: {lg: {slots: ['PreHeader','SiteContext','SiteLinks','SiteLogo','SearchBox','SiteLogin','MiniCart','NavigationBar',],},slots: ['PreHeader', 'SiteLogo', 'SearchBox', 'MiniCart'],},navigation: {lg: { slots: [] },slots: ['SiteLogin', 'NavigationBar', 'SiteContext', 'SiteLinks'],},footer: {slots: ['Footer'],},LandingPage2Template: {pageFold: 'Section2B',slots: ['Section1','Section2A','Section2B','Section2C','Section3','Section4','Section5',],},ContentPage1Template: {slots: ['Section2A', 'Section2B'],},CategoryPageTemplate: {pageFold: 'Section2',slots: ['Section1', 'Section2', 'Section3'],},ProductListPageTemplate: {slots: ['ProductLeftRefinements', 'ProductListSlot'],},ProductGridPageTemplate: {slots: ['ProductLeftRefinements', 'ProductGridSlot'],},SearchResultsListPageTemplate: {slots: ['Section2','ProductLeftRefinements','SearchResultsListSlot','Section4',],},SearchResultsGridPageTemplate: {slots: ['Section2','ProductLeftRefinements','SearchResultsGridSlot','Section4',],},ProductDetailsPageTemplate: {lg: {pageFold: 'UpSelling',},pageFold: 'Summary',slots: ['Summary','UpSelling','CrossSelling','Tabs','PlaceholderContentSlot',],},CartPageTemplate: {slots: ['TopContent', 'CenterRightContentSlot', 'EmptyCartMiddleContent'],},AccountPageTemplate: {slots: ['BodyContent', 'SideContent'],},LoginPageTemplate: {slots: ['LeftContentSlot', 'RightContentSlot'],},ErrorPageTemplate: {slots: ['TopContent', 'MiddleContent', 'BottomContent'],},OrderConfirmationPageTemplate: {slots: ['BodyContent', 'SideContent'],},MultiStepCheckoutSummaryPageTemplate: {slots: ['TopContent', 'BodyContent', 'SideContent', 'BottomContent'],},CheckoutLoginPageTemplate: {slots: ['RightContentSlot'],},}, };/*** @deprecated the b2cLayoutConfig will be dropped with version 4.0.** With Spartacus 3.0 we started to align various layout configurations. Moreover, we move* into a pattern where layout configurations are shattered through various (lazy loaded) modules.*/ export const b2cLayoutConfig: LayoutConfig = layoutConfig;

mediaConfig

import { MediaConfig } from '../../shared/components/media/media.config';export const mediaConfig: MediaConfig = {mediaFormats: {mobile: {width: 400,},tablet: {width: 770,},desktop: {width: 1140,},widescreen: {width: 1400,},// product mediacartIcon: {width: 65,},thumbnail: {width: 96,},product: {width: 284,},zoom: {width: 515,},}, };

CmsContentConfig

import { CmsStructureConfig } from '@spartacus/core'; import {defaultPageHeaderConfig,headerComponents, } from './default-header.config';export function defaultCmsContentConfig(): CmsStructureConfig {return {cmsStructure: {components: {...headerComponents,},slots: {...defaultPageHeaderConfig,},pages: [],},}; } import { CmsPageSlotsConfig, ContentSlotComponentData } from '@spartacus/core';export const headerComponents: {[key: string]: ContentSlotComponentData | any; } = {HamburgerMenuComponent: {typeCode: 'HamburgerMenuComponent',flexType: 'HamburgerMenuComponent',},LoginComponent: {typeCode: 'LoginComponent',flexType: 'LoginComponent',uid: 'LoginComponent',}, };export const defaultPageHeaderConfig: CmsPageSlotsConfig = {PreHeader: {componentIds: ['HamburgerMenuComponent'],},SiteLogin: {componentIds: ['LoginComponent'],}, };

總結(jié)

以上是生活随笔為你收集整理的SAP Spartacus B2cStorefrontModule里提供的默认配置的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。