admin管理员组

文章数量:1613368

介绍一个UI库 - Fundamental style

今天给大家介绍一个由SAP开发并开源的UI库 -Fundamental style。它符合SAP最新的Fiori 3设计。

主页: https://sap.github.io/fundamental-styles/

支持React, Vue,Angular。

大致浏览了一下常用的组件,还是蛮漂亮的。

测试小Demo

  1. 通过API获取后端银行数据
    简化起见,我把获取的数据保存为了本地json。大致像这样:
{
    "BankCountry": "US",
        "BankInternalID": "444444",
        "BankName": "Citibank NY",
        "SWIFTCode": "CHASUS33XXX",
        "BankGroup": "",
        "BankNumber": "",
        "Region": "NY",
        "StreetName": "Citi. 388 Greenwich Street",
        "CityName": "New York",
        "Branch": ""
}
  1. 前端通过列表展示

通过React构建了两个组件:导航条和内容。

内容Banks.js:

import React from 'react';
import data from './response_banks';


export default function Banks() {


    return (
        <table class="fd-table">
            <thead class="fd-table__header">
                <tr class="fd-table__row">

                    <th class="fd-table__cell" scope="col">Bank Name</th>
                    <th class="fd-table__cell" scope="col">Bank Country</th>
                    <th class="fd-table__cell" scope="col">Region</th>
                    <th class="fd-table__cell" scope="col">Street Name</th>
                </tr>
            </thead>

            <tbody class="fd-table__body">

                {
                    data.d.results.map(
                        b =>

                            <tr class="fd-table__row">

                                <td class="fd-table__cell">{b.BankName}</td>
                                <td class="fd-table__cell">{b.BankCountry}</td>
                                <td class="fd-table__cell">{b.Region}</td>
                                <td class="fd-table__cell">{b.StreetName}</td>

                            </tr>
                    )
                }

            </tbody>
        </table>
    );
}
  1. 本地测试运行
npm run

运行结果如下:

  1. 部署到SAP Cloud Foundry
cf push

可以在这里访问demo:

https://test08-funny-porcupine.cfapps.eu10.hana.ondemand/

小结

Fundarmental可以让大家在项目中很方便的保留自己熟悉的框架,依然通过Fiori的用户体验。推荐可以关注一下。

本文标签: fundamentalstyle