插件代码直接拷贝的:https://gitcode.com/dcloud/uni-api/tree/master/uni_modules/uni-getbatteryinfo 然后引用

- 发布:2025-09-22 17:22
- 更新:2025-09-22 17:41
- 阅读:45
【报Bug】uts插件编译到鸿蒙,不支持import * as xxx from '@/uni_modules/uts-getbatteryinfo'的写法,白屏报错
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 15.6.1
HBuilderX类型: 正式
HBuilderX版本号: 4.76
手机系统: HarmonyOS NEXT
手机系统版本号: HarmonyOS 5.0.5
手机厂商: 华为
手机机型: nova 12 pro
页面类型: vue
vue版本: vue3
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
编译到鸿蒙手机
编译到鸿蒙手机
预期结果:
可以使用
可以使用
实际结果:
白屏
白屏
bug描述:
白屏,无法使用:
import * as BatteryInfo from '@/uni_modules/uts-getbatteryinfo'
console.log("BatteryInfo", BatteryInfo)
//报错OH_JSVM_CallFunction failed TypeError: 'getOwnPropertyDescriptor' on proxy: trap reported non-configurability for property 'getBatteryInfo' which is either non-existent or configurable in the proxy target
这种可以正常使用:
// import {getBatteryInfo} from '@/uni_modules/uts-getbatteryinfo'
// console.log("getBatteryInfo",getBatteryInfo)
2 个回复
汉堡王 (作者)
附件代码
import语句在 index.js中
汉堡王 (作者)
试了几个官方demo中的插件拷贝过来都不能import *,但是在安卓和iOS下这样用没有问题