HarmonyOS鸿蒙Next SDK 5.0.0 (12) 版本中,无法使用 @ohos:arkui.StateManagement 中 UIUtils API,其他 PersistenceV2 和 AppStorageV2 等 API 却是可以的?
HarmonyOS鸿蒙Next SDK 5.0.0 (12) 版本中,无法使用 @ohos:arkui.StateManagement 中 UIUtils API,其他 PersistenceV2 和 AppStorageV2 等 API 却是可以的?
Error message: the requested module ‘@ohos:arkui.StateManagement’ does not provide an export name ‘UIUtils’ which imported by ‘&entry/src/main/ets/pages/Index&’
Stacktrace:
- at anonymous (entry/src/main/ets/pages/Index.ets:27:72)
- at updateFunc (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:8791:1)
- at observeComponentCreation2 (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:8811:1)
- at initialRender (entry/src/main/ets/pages/Index.ets:25:11)
- at initialRenderView (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:8776:1)
更多关于HarmonyOS鸿蒙Next SDK 5.0.0 (12) 版本中,无法使用 @ohos:arkui.StateManagement 中 UIUtils API,其他 PersistenceV2 和 AppStorageV2 等 API 却是可以的?的实战教程也可以访问 https://www.itying.com/category-93-b0.html
看不到你Index.ets:的代码,你是怎么import的?我这边看是正常的:
import { UIUtils } from '@kit.ArkUI';
class NonObservedClass {
name: string = "Tom";
}
let nonObservedClass: NonObservedClass = new NonObservedClass();
@Entry
@Component
struct Index {
@State someClass: NonObservedClass = nonObservedClass;
build() {
Column() {
Text(`this.someClass === nonObservedClass: ${this.someClass === nonObservedClass}`) // false
Text(`UIUtils.getTarget(this.someClass) === nonObservedClass: ${UIUtils.getTarget(this.someClass) ===
nonObservedClass}`) // true
}
}
}
更多关于HarmonyOS鸿蒙Next SDK 5.0.0 (12) 版本中,无法使用 @ohos:arkui.StateManagement 中 UIUtils API,其他 PersistenceV2 和 AppStorageV2 等 API 却是可以的?的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
姓名
张三
职位
软件工程师
基本信息
- 所在地: 北京
- 工作年限: 5年
- 毕业院校: 清华大学
个人简介
本人从事软件开发多年,擅长Java和Python编程。
贴一下你的index。ets代码,
在HarmonyOS鸿蒙Next SDK 5.0.0 (12)版本中,@ohos:arkui.StateManagement
模块的UIUtils
API可能已被弃用或移除。PersistenceV2
和AppStorageV2
等API仍可用,表明这些功能在当前版本中得到了保留或更新。建议查阅官方文档或更新日志,确认UIUtils
API的具体状态。
在HarmonyOS鸿蒙Next SDK 5.0.0 (12)版本中,@ohos:arkui.StateManagement
模块的UIUtils
API无法使用,可能是因为该API在SDK 5.0.0中尚未实现或已被移除。建议查阅官方文档或SDK更新日志,确认该API的状态。如果确实不可用,可以考虑使用替代方案或等待后续版本更新。同时,确保开发环境配置正确,并尝试清理项目缓存后重新构建。