技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
syntax (`Button$PressEvent`)\n\n**SimpleForm renders incorrectly on desktop**\n- Cause: `SimpleForm` is deprecated, lacks responsive column layout\n- Solution: Replace with `Form` + `ColumnLayout` — single column on phone, multi on desktop\n\n**`jQuery.sap.require` causes sync load warning**\n- Cause: Legacy synchronous module loader\n- Solution: Replace with `sap.ui.define` async dependency array\n\n## Verification\n\n```bash\n# Type-check TypeScript\nnpx tsc --noEmit\n\n# Lint with UI5 tooling\nnpx ui5 lint\n\n# Start dev server and verify app loads\nnpx ui5 serve --port 8080\n# Open http://localhost:8080 — check console for CSP or module errors\n```\n\nConfirm:\n- [ ] No `jQuery.sap.require` calls remain (`grep -r \"jQuery.sap.require\" webapp/`)\n- [ ] No `SimpleForm` in new views\n- [ ] No inline scripts in XML views\n- [ ] `npx tsc --noEmit` passes with zero errors\n","licenseDocuments":[]}}
sapui5-framework【数据与研究】SAPUI5/OpenUI5 framework development — async module loading, OData V2/V4 binding, i18n, CSP compliance, TypeScript migration, form/table control selection. Use when writing or modernizing SAPUI5 applications.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: sapui5-framework description: SAPUI5/OpenUI5 framework development — async module loading, OData V2/V4 binding, i18n, CSP compliance, TypeScript migration, form/table control selection. Use when writing or modernizing SAPUI5 applications. trigger:
@ui5/cli installed globally: npm install -g @ui5/clinpm install --save-dev @ui5/ts-types-esm typescript# Create a new UI5 app with TypeScript
npx ui5-app-ts my-app
cd my-app
npm install
Verify manifest.json contains "sap.ui5": { "dependencies": { "minUI5Version": "1.120" } }.
sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/ui/model/json/JSONModel",
"sap/m/MessageToast"
], function (Controller, JSONModel, MessageToast) {
"use strict";
return Controller.extend("my.app.controller.Main", {
onInit: function () {
this.getView().setModel(new JSONModel({ items: [] }));
}
});
});
Never use jQuery.sap.require — it is synchronous and deprecated since 1.58.
// V4 (preferred) — context binding with expand
this.getView().bindElement({
path: "/Products('ABC123')",
parameters: { $expand: "to_Text" }
});
// V2 (legacy) — manual read with filter
var oModel = this.getView().getModel();
oModel.read("/Products", {
filters: [new sap.ui.model.Filter("Material", "EQ", "MAT001")],
success: function (oData) { /* ... */ }
});
// manifest.json — register model
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": { "bundleName": "my.app.i18n.i18n" }
}
}
// Controller usage
var sText = this.getView().getModel("i18n").getResourceBundle().getText("appTitle");
import Controller from "sap/ui/core/mvc/Controller";
import Button$PressEvent from "sap/m/Button$PressEvent";
export default class MainController extends Controller {
onButtonPress(event: Button$PressEvent): void {
const oButton = event.getSource();
// type-safe access
}
}
Build with npx ui5 build --all --config ui5.yaml then npx tsc --noEmit for type checking.
Use sap.ui.layout.form.Form with ColumnLayout for all new code.
Avoid SimpleForm — it is deprecated and does not support responsive grid.
UI5 ≥ 1.115 enforces CSP by default. Rules:
<script> blocks — all JS goes in controller fileseval() or new Function()on* event handler attributes in HTML/XML viewsInline scripts rejected by CSP
<script> tags inside XML views or index.htmlsap.ui.defineOData V4 binding silently fails
bindElementContext (V2 API) instead of bindElement (V4 API)bindElement({ path, parameters }) for V4 modelsTypeScript event types not found
@ui5/ts-types-esm package or wrong import pathnpm install --save-dev @ui5/ts-types-esm and import using $ syntax (Button$PressEvent)SimpleForm renders incorrectly on desktop
SimpleForm is deprecated, lacks responsive column layoutForm + ColumnLayout — single column on phone, multi on desktopjQuery.sap.require causes sync load warning
sap.ui.define async dependency array# Type-check TypeScript
npx tsc --noEmit
# Lint with UI5 tooling
npx ui5 lint
# Start dev server and verify app loads
npx ui5 serve --port 8080
# Open http://localhost:8080 — check console for CSP or module errors
Confirm:
jQuery.sap.require calls remain (grep -r "jQuery.sap.require" webapp/)SimpleForm in new viewsnpx tsc --noEmit passes with zero errors