Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat small program API window


May 19, 2021 WeChat Mini Program Development Document


Table of contents


wx.setWindowSize(Object object)

Base Library 2.10.1 starts to be supported, and low versions need to be compatible.
Starting with the base library 2.11.0, this interface stops maintenance

Set the window size, this interface is only available for PC platforms, see the guide for usage rules

Parameters

Object object

Property Type The default Required Description
width number Is Window width, in pixels
height number Is Window height, in pixels
success function Whether The interface calls a successful callback function
fail function Whether The interface calls the failed callback function
complete function Whether Callback function at end of interface call (call succeeds, fails are executed)




wx.onWindowResize(function callback)

The base library 2.3.0 starts to support, and the lower version needs to be compatible.

Listen for window size change events

Parameters

function callback

The callback function for window size change events

Parameters

Object res
Property Type Description
size Object

The structure of size

Property Type Description
windowWidth number Changed window width in px
windowHeight number Changed window height in px




wx.offWindowResize(function callback)

The base library 2.3.0 starts to support, and the lower version needs to be compatible.

Cancel listening for window size change events

Parameters

function callback

The callback function for window size change events