# BannerAd wx.createBannerAd(Object object)
Start from base library version 2.0.4. Please remaining backward compatible.
Creates a banner ad component. Before using this API, you must check whether the base library version is 2.0.4 or above through the object's SDKVersion returned by wx.getSystemInfoSync(). A new instance is returned each time a banner ad is created by calling this method.
# Parameters
# Object object
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
adUnitId | string | Yes | Ad unit ID | |
style | Object | Yes | The style of the banner ad component. |
object.style is composed as follows
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
left | number | Yes | The x-coordinate of the top-left corner of the banner ad component. | |
top | number | Yes | The y-coordinate of the top-left corner of the banner ad component. | |
width | number | Yes | The width of the banner ad component. | |
height | number | Yes | The height of the banner ad component. |
# Return Values
# BannerAd
The banner ad component.