Banner 广告组件
简介
Banner 广告。
属性说明
| 属性名 | 类型 | 是否必填 | 默认值 | 描述 | 最低支持版本号 | 
|---|---|---|---|---|---|
| app-id | string | 是 | 小程序总应用ID(从 hisavana 平台获取配置) | 2.2.0 | |
| code-seat-id | string | 是 | 小程序代码位ID(从 hisavana 平台获取配置) | 2.2.0 | |
| code-seat-type | string | 是 | 2 | banner/横幅,请设置为 "2",如若随意填写,会无法请求到广告 | 2.2.0 | 
| bindload | eventhandle | 否 | 广告加载成功的回调 | 2.2.0 | |
| binderror | eventhandle | 否 | 广告加载失败的回调 | 2.2.0 | |
| bindclose | eventhandle | 否 | 广告关闭时的回调 | 2.2.0 | 
广告类型说明
| 值 | 类型 | 说明 | 
|---|---|---|
| 1 | string | native/原生 | 
| 2 | string | banner/横幅 | 
| 3 | string | 插屏 | 
| 4 | string | 开屏,暂时不支持 | 
| 5 | string | 激励视频,暂时不支持 | 
示例
<!-- pages/index/index.dlt -->
<view>
  <ad
    code-seat-id="xxx"
    app-id="xxx"
    code-seat-type="2"
    bind:binderror="handleAdError"
  >
  </ad>
</view>
// pages/index/index.js
Page({
  handleAdError() {
    console.log("ad error");
  },
});