SAP Spartacus 命名的由来
SAP Commerce Cloud是SAP一款電商解決方案,而Storefront這個(gè)術(shù)語,指的是該解決方案的前臺店鋪界面。一句話概括Spartacus,它是基于現(xiàn)代Web開發(fā)技術(shù)和框架打造而成的一款新的SAP Commerce Cloud Storefront. 何謂現(xiàn)代?Spartacus 1.0版發(fā)布于2019年7月,因此相比前一代基于Accelerator技術(shù)的Storefront來說,Spartacus具有得天獨(dú)厚的優(yōu)勢,能夠采取比較成熟和現(xiàn)代的前端技術(shù)來開發(fā)。
Spartacus四大特性之一:單頁面應(yīng)用single page Application,這也是Spartacus命名的由來。單頁面應(yīng)用,是由一個(gè)外殼html頁面和多個(gè)包含具體業(yè)務(wù)邏輯的頁面片段組成。Commerce傳統(tǒng)Storefront基于JSP實(shí)現(xiàn),JSP是一種服務(wù)器端渲染技術(shù),頁面代碼在Commerce服務(wù)器端完成。而單頁面應(yīng)用是一種富客戶端技術(shù),頁面片段渲染以及頁面路由放在客戶端完成,這樣減輕了Commerce服務(wù)器的負(fù)載。當(dāng)單頁面應(yīng)用的界面內(nèi)容發(fā)生變化時(shí),不需要重新加載整個(gè)外殼html頁面,而僅僅需要更新相關(guān)的頁面片段,這樣較多頁面應(yīng)用相比,頁面之間的切換更加流暢,用戶體驗(yàn)更好。
下圖就是SAP Spartacus的shell html頁面:
實(shí)現(xiàn)源代碼:
<!DOCTYPE html> <html><head><meta name="viewport" content="width=device-width, initial-scale=1" /><link rel="icon" type="image/x-icon" href="favicon.ico" /><link rel="manifest" href="manifest.json" /><meta charset="utf-8" /><meta name="mobile-web-app-capable" content="yes" /><meta name="apple-touch-fullscreen" content="yes" /><meta name="apple-mobile-web-app-title" content="Spartacus" /><meta name="apple-mobile-web-app-capable" content="yes" /><meta name="apple-mobile-web-app-status-bar-style" content="default" /><linkrel="apple-touch-icon"sizes="192x192"href="assets/icons/icon-192x192.png"/><linkhref="assets/splash/iphone5_splash.png"media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"rel="apple-touch-startup-image"/><linkhref="assets/splash/iphone6_splash.png"media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"rel="apple-touch-startup-image"/><linkhref="assets/splash/iphoneplus_splash.png"media="(device-width: 621px) and (device-height: 1104px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"rel="apple-touch-startup-image"/><linkhref="assets/splash/iphonex_splash.png"media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"rel="apple-touch-startup-image"/><linkhref="assets/splash/iphonexr_splash.png"media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"rel="apple-touch-startup-image"/><linkhref="assets/splash/iphonexsmax_splash.png"media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"rel="apple-touch-startup-image"/><linkhref="assets/splash/ipad_splash.png"media="(device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"rel="apple-touch-startup-image"/><linkhref="assets/splash/ipadpro1_splash.png"media="(device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"rel="apple-touch-startup-image"/><linkhref="assets/splash/ipadpro3_splash.png"media="(device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"rel="apple-touch-startup-image"/><linkhref="assets/splash/ipadpro2_splash.png"media="(device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"rel="apple-touch-startup-image"/><meta name="occ-backend-base-url" content="OCC_BACKEND_BASE_URL_VALUE" /><metaname="media-backend-base-url"content="MEDIA_BACKEND_BASE_URL_VALUE"/><title>Spartacus Storefront</title><base href="/" /><scriptid="smartedit-injector"src="webApplicationInjector.js"data-smartedit-allow-origin="localhost:9002"></script></head><body><cx-storefront>Loading...</cx-storefront></body> </html>其中body標(biāo)簽的自定義標(biāo)簽cx-storefront, 運(yùn)行時(shí)會被Spartacus Storefront庫里的實(shí)現(xiàn)填充:
更多Jerry的原創(chuàng)文章,盡在:“汪子熙”:
總結(jié)
以上是生活随笔為你收集整理的SAP Spartacus 命名的由来的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SAP Spartacus的PWA支持
- 下一篇: 腾讯 AI 智能聊天互动专利获授权:可多