# setPageOrientation(Object object)

设置当前小程序页面方向
**注意事项**：- API设定的方向会覆盖当前页面从json中获取过来的orientation配置信息
- 如果页面被销毁了, 下次重新创建页面的时候, 会使用json中配置的orientation字段信息
- 不支持在 iPad 上调用

## 支持说明

应用能力 | Android | iOS | PC | Harmony | 预览效果
---|---|---|---|---|---
小程序 | V5.26.0+ | V5.26.0+ | **X** | V7.35.0+ | 预览
网页应用 | **X** | **X** | **X** | **X** | 预览

## 输入
继承[标准对象输入](https://open.feishu.cn/document/uYjL24iN/ukzNy4SO3IjL5cjM)，扩展属性描述：

名称 | 数据类型 | 必填 | 默认值 | 描述
---|---|---|---|---
orientation | string | 是 | &nbsp; | 页面方向<br>**可选值** : <br>- `portrait` : 竖屏<br>- `landscape` : 横屏<br>**注意事项**：**注意**：<br>- Harmony 端：暂不支持`landscape`值

## 输出
继承[标准对象输出](https://open.feishu.cn/document/uYjL24iN/ukzNy4SO3IjL5cjM#8c92acb8)，无扩展属性
## 示例代码

```js
  tt.setPageOrientation({
      orientation: 'portrait',
      success: function(res) {
          console.log('set page orientation success')
      },
      fail: function(res) {
          console.log('set page orientation fail: '+ JSON.stringify(res))
      }
  })
```

