SAP OPEN UI5 Step1 环境安装和hello world

转载请联系vx:xiaoshitou5854

1,安装ui5

npm install --global @ui5/cli

2,创建你的项目的文件夹app1,进入app1文件夹后,执行init

npm init --yes

3,在app1里创建webapp文件夹

4,在app1文件夹里执行,生成ui5.yaml

ui5 init

注意:在windows下的vscode的命令行下执行此命令会出下面的错误:

ui5 : C:UsersaaaApp DataRoaming
pmui5.ps1 「about_Execution_Polic 
ies」(https://go.microsoft.com/fwlink/?LinkID=135170) 
+ ui5 init
+ ~~~
    + FullyQualifiedErrorId : UnauthorizedAccess

解决办法:管理员身份运行powershell,执行Set-ExecutionPolicy RemoteSigned命令,然后有个提示,然后输入A,就可以了。
参考:https://kaede.jp/2017/01/23005300/
5,在webapp里创建manifest.json文件,文件的内容从这里,copy出来,修改下面的部分。

如果link失效,可以在搜索【open ui5 createing a descriptor file for existing apps】,也能找到link

 "handleValidation": false,
 "extends": {
            "component" : "<extendedComponentId>",
			"minVersion": "<minComp1Version>",
			"extensions": {}
        },
 "contentDensities": {
            "compact": false,
            "cozy": false
        }

5,在app1文件夹里执行,会更新ui5.yaml

ui5 use SAPUI5@latest

6,在webapp文件夹下创建index.html文件

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>SAPUI5 Walkthrogh</title>
    </head>
    <body>
        <dir>Hello Word</dir>
    </body>
</html>

7,启动server,在app1文件夹下执行

$ ui5 serve
Server started
URL: http://localhost:8080

8,在浏览器里值执行:http://localhost:8080/index.html

可以看到Hello Word,表示了出来。

官方教程:https://openui5.hana.ondemand.com/topic/3da5f4be63264db99f2e5b04c5e853db

本人微信:xiaoshitou5854

原文地址:https://www.cnblogs.com/xiaoshiwang/p/14909074.html