跳到主要内容
版本:3.x

AdCustom

Banner 广告

支持情况:

参考文档

类型​

ComponentType<AdCustomProps>

示例代码​

class App extends Component {
render () {
return (
<AdCustom
unitId=''
adIntervals={60}
onLoad={() => console.log('ad onLoad')}
onError={() => console.log('ad onError')}
onClose={() => console.log('ad onClose')}
/>
)
}
}

AdCustomProps​

参数类型必填说明
unitIdstring是广告单元id,可在小程序管理后台的流量主模块新建
adIntervalsnumber否广告自动刷新的间隔时间,单位为秒,参数值必须大于等于30(该参数不传入时 Banner 广告不会自动刷新)
onLoadCommonEventFunction否广告加载成功的回调
onErrorCommonEventFunction<AdProps.onErrorEventDetail>否当广告发生错误时,触发的事件,可以通过该事件获取错误码及原因

API 支持度​

API微信小程序H5React NativeHarmony
AdCustomProps.unitId✔️
AdCustomProps.adIntervals✔️
AdCustomProps.onLoad✔️
AdCustomProps.onError✔️