UNPKG

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