参考以下两种方法:1.在module.json5文件中配置"orientation": "portrait"。参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/module-configuration-file-V52.在EntryAbility的onWindowStageCreate中设置window.getLastWindow(this.context).then((lastWindow) => { lastWindow.setPreferredOrientation(window.Orientation.PORTRAIT) });参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-window-V5\#setpreferredorientation9
参考以下两种方法:1.在module.json5文件中配置"orientation": "portrait"。
参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/module-configuration-file-V5
2.在EntryAbility的onWindowStageCreate中设置
参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-window-V5\#setpreferredorientation9