如何在SAP Fiori应用里使用React component

在MyApp.jsx里引入UI5针对React框架的开发的Card web Component:

代码如下:


import React from 'react'
import { Card } from "@ui5/webcomponents-react";

export function MyApp() {
  return (
    <div>
      <Card heading="Card"></Card>
    </div>
  );
}

然后和正常的React应用一样,在App.js里引入我们自定义的Component:

代码如下:

import React from "react";
import { MyApp } from "./MyApp";
import { ThemeProvider } from "@ui5/webcomponents-react/lib/ThemeProvider";

function App() {
  return (
    <ThemeProvider withToastContainer>
      <MyApp />
    </ThemeProvider>
  );
}

export default App;

这个Card Component是SAP发布的针对React框架的标准组件。

可以在这个链接里看到明细:

https://sap.github.io/ui5-webcomponents-react/?path=/story/welcome-getting-started–page

开发完毕后,npm start可以看到效果了:

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

发布了6551 篇原创文章 · 获赞 629 · 访问量 106万+

猜你喜欢

转载自blog.csdn.net/i042416/article/details/104194192