openUI5/SAPUI框架介绍(02)(持续更新)

本文介绍了如何在新项目中安装依赖并运行OpenUI5项目,重点讲解了XML视图的命名规则和Controller命名约定,以及如何绑定事件。核心内容包括视图文件结构、控制器命名规范(view名=controller名)和事件处理机制。
摘要由CSDN通过智能技术生成

last step. we got a new project, it is a initial project, first of all, we will know the meaning of each folder. as follows:
在这里插入图片描述
we need to run this project, before this, we need to install related dependencies.
so npm install. now get the node_modules, then, grunt serve
then the project runs on port 9555.
在这里插入图片描述

webapp is default folder, after the folder is expanded, got some files. now
step by step and one by one;
1: XML Views (webapp/view/Main.view.xml)
acturelly,openui5 supports multiple view types (XML HTML Javascript) we choose XML as project. the most readable code and will force us to to separate the view declaration from the controller logic.
OK, the root node of the XML structure is the view. here. we reference the default namespace sap.m where the majority of our UI assets are located, we define an additional sap.ui.core.mvc namespace width alias mvc, where the openui5 views and other Model-View-Controller(mvc) assets are located. (openui5支持多种形式的视图。我们大多都选xml。逻辑分离,一些命名空间, 如sap.m, 主要是UI文件所在)
ok, do something width components;
在这里插入图片描述

在这里插入图片描述
if you want to add new xml, just like this:在这里插入图片描述
so, we know that
1:view name are capitalized
2:all views are stored in the view folder
3: name of XML view always end with .view.xml

2: Controller (webapp/controller/Main.controller.js)

Look at the code

sap.ui.define([
    "sap/ui/core/mvc/Controller"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值