在Cocos Creator中创建bannerAd
wx.createBannerAd
if (sys.platform == sys.Platform.WECHAT_GAME) {
let ad = wx.createBannerAd({
adUnitId: 'xxxxx',
adIntervals: 300,
style: {
left: 0,
top: 0,
height: 0,
width: wx.getSystemInfoSync().windowWidth
}
})
ad.onResize((size) => {
ad.style.top = wx.getSystemInfoSync().windowHeight - size.height + 1
})
ad.onError((err) => {
console.log(err)
})
ad.show()
}