封装方法
const bdMixin
= {
methods
: {
loadBDAd (l
) {
const r
= window
const d
= document
r
._agl
= r
._agl
|| []
r
._agl
.push(['production', l
])
var agl
= d
.createElement('script')
agl
.type
= 'text/javascript'
agl
.async = true
agl
.src
= 'https://fxgate.baidu.com/angelia/fcagl.js?production=' + l
var s
= d
.getElementsByTagName('script')[0]
s
.parentNode
.insertBefore(agl
, s
)
}
}
}
export default bdMixin
页面使用
import bdMixin
from '../../mixins/bd'
export default{
mixins
: [bdMixin
],
metodes
:{
postMinUser({ ...obj
}).then(res
=> {
if (res
.status
=== 201) {
window
._agl
&& window
._agl
.push(['track', ['success', { t
: 3 }]])
}
}).catch(err
=> {
})
}, 300)
}
}
转载请注明原文地址:https://tech.qufami.com/read-12922.html