SAP Spartacus Route Alias
生活随笔
收集整理的這篇文章主要介紹了
SAP Spartacus Route Alias
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
https://sap.github.io/spartacus-docs/route-aliases/
SAP Spartacus semantic route的paths是一個數組,可以容納多個paths記錄:
ConfigModule.withConfig({routing: {routes: {product: {paths: [':campaignName/product/:productCode','product/:productCode']}}} })Then a configurable router link will use the first configured path alias from the paths array that can satisfy its params with given params object. So it’s good to order aliases from those that require the most specific parametes to those having less parameters.
最佳實踐就是,路由路徑里需要提供越多參數的route,應該越出現在paths數組的前部。
下面這種是錯誤的route alias配置方式,因為在productCode被提供的前提條件下,第一條記錄p/:productCode總是被優先匹配,而第二條記錄永遠沒有機會得到應用。
總結
以上是生活随笔為你收集整理的SAP Spartacus Route Alias的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 特殊字符转义
- 下一篇: 人类希望!星舰并未失败 今年砸20亿美元