天天看點

SAP UI5 Web Component不同React頁面的跳轉實作

(1) 從react-router-dom裡導入Switch,Route和Redirect元件:

SAP UI5 Web Component不同React頁面的跳轉實作

(2) 路徑/home指定成加載Home Component ,/detail則加載Detail Component.

SAP UI5 Web Component不同React頁面的跳轉實作

檔案Home.jsx和Detail.jsx分别實作Component:

SAP UI5 Web Component不同React頁面的跳轉實作

(3) 測試:url後加上/home,則加載home Component:

SAP UI5 Web Component不同React頁面的跳轉實作

/detail元件的加載:

SAP UI5 Web Component不同React頁面的跳轉實作