白沙黎族自治县网站建设_网站建设公司_前端开发_seo优化
2026/1/21 20:13:52 网站建设 项目流程

坑1:Component.ts漏写@namespace注解,导致异常

/** * @namespace ui5.walkthrough */

会导致编译成的js,缺少组件命名空间,声明实现 IAsyncContentCreation 接口也不会被正确识别

应用会抛异常

Failed to load component for container container - Error: Interface 'sap.ui.core.IAsyncContentCreation' must be implemented for component 'sap.ui.core' when 'createContent' is implemented asynchronously
Error: Interface 'sap.ui.core.IAsyncContentCreation' must be implemented for component 'sap.ui.core' when 'createContent' is implemented asynchronously

补上注解后

/** * @namespace ui5.walkthrough */

编译的js文件,组件正确的带上了命名空间UIComponent.extend("ui5.walkthrough.Component"

应用也正常运行了

总结:以前我以为注释都是给人看的,一般都懒得写,实际有些注解会影响下ui5 cli工具的编译结果,间接也就影响了程序。需要谨慎对待所有@相关的注解

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询