UNPKG

1.39 kBTypeScriptView Raw
1import { ComponentType } from 'react'
2import { StandardProps, CommonEventFunction } from './common'
3import { AdProps } from './Ad'
4interface AdCustomProps extends StandardProps {
5 /** 广告单元id,可在[小程序管理后台](https://mp.weixin.qq.com/)的流量主模块新建
6 * @supported weapp
7 */
8 unitId: string
9 /** 广告自动刷新的间隔时间,单位为秒,参数值必须大于等于30(该参数不传入时 Banner 广告不会自动刷新)
10 * @supported weapp
11 */
12 adIntervals?: number
13 /** 广告加载成功的回调
14 * @supported weapp
15 */
16 onLoad?: CommonEventFunction
17 /** 当广告发生错误时,触发的事件,可以通过该事件获取错误码及原因
18 * @supported weapp
19 */
20 onError?: CommonEventFunction<AdProps.onErrorEventDetail>
21}
22/** Banner 广告
23 * @classification open
24 * @supported weapp
25 * @example
26 * ```tsx
27 * class App extends Component {
28 * render () {
29 * return (
30 * <AdCustom
31 * unitId=''
32 * adIntervals={60}
33 * onLoad={() => console.log('ad onLoad')}
34 * onError={() => console.log('ad onError')}
35 * onClose={() => console.log('ad onClose')}
36 * />
37 * )
38 * }
39 * }
40 * ```
41 * @see https://developers.weixin.qq.com/miniprogram/dev/component/ad.html
42 */
43declare const AdCustom: ComponentType<AdCustomProps>
44export { AdCustom, AdCustomProps }