ITPub博客

首页 > 应用开发 > IT综合 > 如何在SAP Fiori应用里使用React component

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

原创 IT综合 作者:i042416 时间:2020-02-17 08:41:18 0 删除 编辑

在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框架的标准组件。


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


Storybook



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


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24475491/viewspace-2675812/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
测试

注册时间:2018-01-20

  • 博文量
    3822
  • 访问量
    1982781