鸿蒙无法设置横屏?
已经全局globalStyle 设置"landscape": true,"pageOrientation": "landscape",
每个页面style也是设置"landscape": true,"pageOrientation": "landscape",
仍然无法起效,需要在编译之后生成的module.json5修改"orientation": "landscape"才行,每次修改麻烦到死
难道不支持吗?

云开发接单
- 发布:2025-10-13 13:01
- 更新:2025-10-13 14:55
- 阅读:45

DCloud_UNI_OttoJi - 日常回复 uni-app/x 问题,如果艾特我没看到,请主动私信
暂未开放。如果你需要个别页面方向切换可以封装 uts 设置全屏,应用横屏你可以直接修改 moduel.json 正确放入到 harmony-configs 即可,不需要每次修改
云开发接单 (作者)
我的是应用全部横屏,你能给一个具体harmony-configs的写法吗?我放在/harmony-configs/entry/src/main/module.json5中abilities[0]数组中设置"orientation": "landscape",但是这样的话直接编译不了,会报错5 开始制作运行包 .hap,请耐心等待 ...
12:53:40.412 > hvigor hvigor client: Starting hvigor daemon.
12:53:40.412 > hvigor Hvigor Daemon started in 260 ms
12:53:40.412 > hvigor ERROR: 00303196 Configuration Error
12:53:40.412 Error Message: Unable to obtain the module type at file: /Users/Zhuanz/Desktop/project/hongmeng2/1_child_traffic/unpackage/dist/dev/app-harmony/entry/src/main/module.json5
12:53:40.412 * Try the following:
12:53:40.412 > Make sure the module.type field is set correctly in the module.json5 file: /Users/Zhuanz/Desktop/project/hongmeng2/1_child_traffic/unpackage/dist/dev/app-harmony/entry/src/main/module.json5
12:53:40.412 > hvigor ERROR: BUILD FAILED in 801 ms
12:53:40.913 运行包制作失败
2025-10-13 15:50
云开发接单 (作者)
是不是得第一次编译之后,把编译之后的 moduel.json 修改之后复制放入到 harmony-configs?如何发布上线版本也会起效对吧
2025-10-13 15:56
DCloud_UNI_OttoJi
回复 云开发接单: 是的 https://uniapp.dcloud.net.cn/tutorial/harmony/runbuild.html#config-dir
2025-10-13 16:34