console.log(JSON.stringify(windowInfo))
- 发布:2024-12-06 14:50
- 更新:2024-12-09 16:42
- 阅读:212
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win11
HBuilderX类型: 正式
HBuilderX版本号: 4.29
手机系统: HarmonyOS NEXT
手机系统版本号: HarmonyOS NEXT Developer Preview
手机厂商: 华为
手机机型: mate60
页面类型: vue
vue版本: vue3
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
windowHeight正常
windowHeight正常
实际结果:
输出:0
同时这里还有一个bug,这个窗口只输入:0,不让提交,难道用的if(!实际结果)这样来判断的?
输出:0
同时这里还有一个bug,这个窗口只输入:0,不让提交,难道用的if(!实际结果)这样来判断的?
bug描述:
console.log(JSON.stringify(windowInfo))打印如下:
{"safeAreaInsets":{"top":32,"bottom":0,"left":0,"right":0},"safeArea":{"top":32,"bottom":799,"left":0,"right":374,"width":374,"height":767},"statusBarHeight":32,"pixelRatio":3.25,"screenHeight":827,"screenTop":0,"screenWidth":374,"windowHeight":0,"windowWidth":0}
为什么windowHeight为0?
我是hx4.29版本,至于后面的版本有没有修复不得而知,因为最新的4.36就是一垃圾版本,项目都跑不起来。
loveCoding (作者)
【本文的两个问题都已经解决,感谢yuhe大佬。获取不到高度的问题升级到hx4.36以上版本。hx4.36运行失败的问题,重新安装devEco最新版本。】
我准备修改一下帖子,但是发现编辑有bug,选择手机os那里不让改,从而不让提交。
-
loveCoding (作者)
从我的结果来看安全区的那些结果全是错的,可以对比safeAreaInsets和safeArea看,另外windowWidth也是0.同时getDeviceInfo和getSystemInfo等都需要同步修复。我无法测试新版的。
2024-12-07 00:28
-
loveCoding (作者)
切换到最新版4.36后的问题:假如我没有harmony-configs这个文件夹就只会创建一个空文件夹。我是保留了4.29的文件夹后再试,安装不了这2个依赖包。大佬救命啊,im群里面的管理都摆烂了:
ohpm ERROR: missing: @dcloudio/uts-harmony@E:\uniapp\unpackage\debug\app-harmony-26d8f534\entry\src\main\ets\uts, required by @
ohpm ERROR: Found exception: Error: Fetch local folder package error, E:\uniapp\unpackage\debug\app-harmony-26d8f534\entry\src\main\ets\uts does not exist., reached retry limit or non retryable error encountered.
ohpm ERROR: ERUNNING execute tasks failed, Error: Fetch local folder package error, E:\uniapp\unpackage\debug\app-harmony-26d8f534\entry\src\main\ets\uts does not exist.
ohpm ERROR: missing: @dcloudio/uni-app-harmony@E:\uniapp\unpackage\debug\app-harmony-26d8f534\entry\src\main\ets\uni-app-harmony, required by @
ohpm ERROR: Found exception: Error: Fetch local folder package error, E:\uniapp\unpackage\debug\app-harmony-26d8f534\entry\src\main\ets\uni-app-harmony does not exist., reached retry limit or non retryable error encountered.
ohpm ERROR: missing: @dcloudio/uni-app-harmony-framework@E:\uniapp\unpackage\debug\app-harmony-26d8f534\entry\src\main\resources\rawfile\uni-app, required by @
ohpm ERROR: Found exception: Error: Fetch local folder package error, E:\uniapp\unpackage\debug\app-harmony-26d8f534\entry\src\main\resources\rawfile\uni-app does not exist., reached retry limit or non retryable error encountered.
ohpm ERROR: Install failed, detail: Error: Fetch local folder package error, E:\uniapp\unpackage\debug\app-harmony-26d8f534\entry\src\main\ets\uts does not exist.
00:38:28.312 安装鸿蒙工程依赖失败2024-12-07 00:42
-
回复 loveCoding: 不要保留 4.29 的文件,会有冲突,需要把这个 harmony-configs 置为空,之后重新配置,只保留需要的文件
2024-12-09 11:03
-
loveCoding (作者)
回复 DCloud_UNI_yuhe: 帮我看下下面那个报错是什么情况,实在是无法排查,如果是代码里面哪里报错了还可以自己找找。这个是uni.api的错误啊。
2024-12-09 13:06
-
loveCoding (作者)
回复 DCloud_UNI_yuhe: https://mp-3343e9ce-7c6b-497a-8836-96d9fa55ba75.cdn.bspapp.com/unpackage.rar
2024-12-09 13:26
loveCoding (作者)
如果是空的也跑不起来啊,试了几次了,心累,configs文件夹不配置任何东西,没有证书和包名等,也不是这个报错吧:1 ERROR: ArkTS:ERROR File: E:/hello-uniapp-vue3/unpackage/debug/app-harmony-26d8f534/oh_modules/.ohpm/@dcloudio+uni-app-runtime@onjt5cnkmpxv8bm+y1oo6mnpqjw8oa6bpkmtp8h3hxs=/oh_modules/@dcloudio/uni-app-runtime/src/main/ets/uni-app-harmony/uni.api.ets:5796:62
Namespace 'photoAccessHelper' has no exported member 'PhotoCreationConfig'.
2 ERROR: ArkTS:ERROR File: E:/hello-uniapp-vue3/unpackage/debug/app-harmony-26d8f534/oh_modules/.ohpm/@dcloudio+uni-app-runtime@onjt5cnkmpxv8bm+y1oo6mnpqjw8oa6bpkmtp8h3hxs=/oh_modules/@dcloudio/uni-app-runtime/src/main/ets/uni-app-harmony/uni.api.ets:5803:65
Property 'showAssetsCreationDialog' does not exist on type 'PhotoAccessHelper'.
3 ERROR: ArkTS:ERROR File: E:/hello-uniapp-vue3/unpackage/debug/app-harmony-26d8f534/oh_modules/.ohpm/@dcloudio+uni-app-runtime@onjt5cnkmpxv8bm+y1oo6mnpqjw8oa6bpkmtp8h3hxs=/oh_modules/@dcloudio/uni-app-runtime/src/main/ets/uni-mp-sdk/WebBuilder.ets:36:6
Property 'keyboardAvoidMode' does not exist on type 'WebAttribute'.
4 ERROR: ArkTS:ERROR File: E:/hello-uniapp-vue3/unpackage/debug/app-harmony-26d8f534/oh_modules/.ohpm/@dcloudio+uni-app-runtime@onjt5cnkmpxv8bm+y1oo6mnpqjw8oa6bpkmtp8h3hxs=/oh_modules/@dcloudio/uni-app-runtime/src/main/ets/uni-mp-sdk/WebBuilder.ets:36:24
Cannot find name 'WebKeyboardAvoidMode'.
5 ERROR: ArkTS:ERROR File: E:/hello-uniapp-vue3/unpackage/debug/app-harmony-26d8f534/oh_modules/.ohpm/@dcloudio+uni-app-runtime@onjt5cnkmpxv8bm+y1oo6mnpqjw8oa6bpkmtp8h3hxs=/oh_modules/@dcloudio/uni-app-runtime/src/main/ets/uni-mp-sdk/components/WebView.ets:34:8
Property 'keyboardAvoidMode' does not exist on type 'WebAttribute'.
6 ERROR: ArkTS:ERROR File: E:/hello-uniapp-vue3/unpackage/debug/app-harmony-26d8f534/oh_modules/.ohpm/@dcloudio+uni-app-runtime@onjt5cnkmpxv8bm+y1oo6mnpqjw8oa6bpkmtp8h3hxs=/oh_modules/@dcloudio/uni-app-runtime/src/main/ets/uni-mp-sdk/components/WebView.ets:34:26
Cannot find name 'WebKeyboardAvoidMode'.
7 ERROR: ERROR File: E:\hello-uniapp-vue3\unpackage\debug\app-harmony-26d8f534\entry\src\main\ets\entryability\EntryAbility.ets
Cannot resolved import statement @dcloudio/uni-app-runtime/index. Please check the case.
COMPILE RESULT:FAIL {ERROR:8 WARN:544}
hvigor ERROR: BUILD FAILED in 30 s 503 ms
12:57:24.884 运行包制作失败
-
loveCoding (作者)
我运行的就是真机,mate60,报错是uts语法报错了,难道是什么缓存我下载到旧的包?你看下我发的编译后的文件,是什么造成的,反正编译得不对。
2024-12-09 14:32
-
loveCoding (作者)
回复 DCloud_UNI_yuhe: 我都是新下载了一个hx4.36最新版,自动安装真机插件测试的。就这个编译后的项目,可测试hx打包为hap包正常吗?反正在devEco里面打包并不报错,也能运行。问题还是出在打包这一步。
2024-12-09 15:17
DCloud_UNI_yuhe
感谢回复
2024-12-09 16:55