From 203180b51c8672b9a6e53415093e5a1c813d53a1 Mon Sep 17 00:00:00 2001 From: hdx Date: Wed, 16 Oct 2024 17:14:41 +0800 Subject: [PATCH] =?UTF-8?q?ad:=20=E5=A2=9E=E5=8A=A0=E5=8E=9F=E7=94=9F?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=AE=9D=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=8E=A5?= =?UTF-8?q?=E5=85=A5=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/uni-ad/ad-alipay-native.md | 150 ++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 docs/uni-ad/ad-alipay-native.md diff --git a/docs/uni-ad/ad-alipay-native.md b/docs/uni-ad/ad-alipay-native.md new file mode 100644 index 000000000..2d79e78cb --- /dev/null +++ b/docs/uni-ad/ad-alipay-native.md @@ -0,0 +1,150 @@ +## uni-ad支持支付宝小程序广告 + +1. 开通方式 + +uni-ad由开发者在DCloud网站[uniad.dcloud.net.cn](https://uniad.dcloud.net.cn)申请,开发者与DCloud开票结算 + +2. 引入插件 + +使用小程序所属支付宝主账号登录,在能力中心订购: + +[https://business.alipay.com/page/fw-market/home/detail/AM010401000000140190](https://business.alipay.com/page/fw-market/home/detail/AM010401000000140190) + + +`app.json` 文件中引入广告插件 + +```json +{ + "usingComponents": { + "uni-ad": "plugin://uni-ad/ad" + }, + "plugins": { + "uni-ad": { + "version": "1.0.2", + "provider": "2021004169623603" + } + } +} +``` + +3. 接入示例 + +`adpid` 属性为广告位id,在 [uni-ad web控制台](https://uniad.dcloud.net.cn/) 中可找到 + +### 信息流广告/Banner + +```html + +``` + +```js +Page({ + onLoad(query) { + }, + onAdLoad(e) { + console.log('onAdLoad', e) + }, + onAdClose(e) { + console.log('onAdClose', e) + }, + onAdError(e) { + console.log('onAdError', e) + } +}); + +``` + + +### 激励视频广告 + +```html + + + + +``` + +```js +Page({ + onLoad(query) { + }, + handleRef(ref) { + this.adRef = ref; + }, + onAdLoad(e) { + console.log('onAdLoad', e) + }, + onAdClose(e) { + console.log('onAdClose', JSON.stringify(e)) + }, + onAdError(e) { + console.log('onAdError', JSON.stringify(e)) + }, + showAd() { + this.adRef.show(); + } +}); +``` + + +### 插屏广告 + +```html + + + + +``` + +```js +Page({ + onLoad(query) { + }, + handleRef(ref) { + this.adRef = ref; + }, + onAdLoad(e) { + console.log('onAdLoad', e) + }, + onAdClose(e) { + console.log('onAdClose', JSON.stringify(e)) + }, + onAdError(e) { + console.log('onAdError', JSON.stringify(e)) + }, + showAd() { + this.adRef.show(); + } +}); +``` + +### 全屏广告 + +```html + + + + +``` + +```js +Page({ + onLoad(query) { + }, + handleRef(ref) { + this.adRef = ref; + }, + onAdLoad(e) { + console.log('onAdLoad', e) + }, + onAdClose(e) { + console.log('onAdClose', JSON.stringify(e)) + }, + onAdError(e) { + console.log('onAdError', JSON.stringify(e)) + }, + showAd() { + this.adRef.show(); + } +}); +``` -- GitLab