提交 73f62484 编写于 作者: d-u-a's avatar d-u-a

update: ad组件增加参数channel

上级 f0b67ac7
......@@ -10,8 +10,7 @@ UniServiceJSBridge.subscribe('onAdMethodCallback', ({
callbackId,
data
}, pageId) => {
const { adpid, width, count } = data
getAdData(adpid, width, count, (res) => {
getAdData(data, (res) => {
operateAdView(pageId, callbackId, 'success', res)
}, (err) => {
operateAdView(pageId, callbackId, 'fail', err)
......@@ -20,7 +19,8 @@ UniServiceJSBridge.subscribe('onAdMethodCallback', ({
const _adDataCache = {}
function getAdData (adpid, width, count, onsuccess, onerror) {
function getAdData (data, onsuccess, onerror) {
const { adpid, width } = data
const key = adpid + '-' + width
const adDataList = _adDataCache[key]
if (adDataList && adDataList.length > 0) {
......@@ -29,11 +29,7 @@ function getAdData (adpid, width, count, onsuccess, onerror) {
}
plus.ad.getAds(
{
adpid,
count,
width
},
data,
(res) => {
const list = res.ads
onsuccess(list.splice(0, 1)[0])
......
......@@ -35,6 +35,10 @@ export default {
dataCount: {
type: Number,
default: 5
},
channel: {
type: String,
default: ''
}
},
data () {
......@@ -150,7 +154,10 @@ export default {
const data = {
adpid: adpid || this.adpid,
width: this.position.width,
count: this.dataCount
count: this.dataCount,
ext: {
channel: this.channel
}
}
UniViewJSBridge.publishHandler('onAdMethodCallback', {
callbackId: this._callbackId,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册