代码拉取完成,页面将自动刷新
在线体验 | English | 更新日志 | Issue | Gitee
npm i landscape-simulator
import LandscapeSimulator from 'landscape-simulator';
LandscapeSimulator.init({
disablePc: false, // 默认为true
})
推荐将上述初始化代码置于head中执行
使用cdn方式时,可将script标签放置在head中
<script src="https://cdn.jsdelivr.net/npm/landscape-simulator/landscape-simulator.min.js"></script>
可以使用属性 auto-simulate=false
来控制不要使用自动开启模拟,默认为自动开启。
可以使用属性 disable-pc=false
来控制在pc端也开启模拟,默认为在pc端不开启。
使用cdn方式引用时,会在window上挂载 LandscapeSimulator
对象
初始化模拟器,使用cdn方式引用时会自动初始化
LandscapeSimulator.init({
disablePc: false, // 默认为true
})
往旋转容器中添加子元素
LandscapeSimulator.appendChild(htmlElement);
获取模拟的过后的屏幕尺寸
const size = LandscapeSimulator.getSimulateSize();
获取当前是否处于模拟横屏的状态
const bool = LandscapeSimulator.isSimulateLandscape();
监听模拟横屏状态改变
LandscapeSimulator.onSimulateChange(isSimulate => {
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。