Online Use | English | 更新日志 | 反馈错误/缺漏 | Gitee
Expand Contents
npm i landscape-simulator
js
import LandscapeSimulator from 'landscape-simulator';
LandscapeSimulator.init({
disablePc: false, // default is true
})
It is recommended to place the above initialization code in the head for execution
When using the cdn method, the script tag can be placed in the head
html
<script src="https://cdn.jsdelivr.net/npm/landscape-simulator/landscape-simulator.min.js"></script>
`
You can use the property auto-simulate=false
to control not to use auto-on simulation, the default
is auto-on.
You can use the attribute disable-pc=false
to control the simulation to be enabled on the pc side.
The default is not to enable it on the pc side.
When referenced by cdn, the LandscapeSimulator
object will be mounted on the window
Initialize the simulator, which will be automatically initialized when referenced by cdn
LandscapeSimulator.init({
disablePc: false, // default is true
})
Add child elements to a rotating container
LandscapeSimulator.appendChild(htmlElement);
Get the emulated later screen size
const size = LandscapeSimulator.getSimulateSize();
Get whether it is currently in a state of simulating a landscape screen
const bool = LandscapeSimulator.isSimulateLandscape();
Listen for changes in the state of the simulated horizontal screen
LandscapeSimulator.onSimulateChange(isSimulate => {
});