我使用的是nuxt-js,我有以下脚本标记
<script type="text/javascript">
atOptions = {
'key' : 'id',
'format' : 'iframe',
'height' : 60,
'width' : 468,
'params' : {}
};
document.write('<scr' + 'ipt type="text/javascript" src="http' + (location.protocol === 'https:' ? 's' : '') + '://www.highperformancedisplayformat.com/id/invoke.js"></scr' + 'ipt>');
</script>
当我在nuxt.config.js上使用这样一个简单的脚本标记时,它正在工作
script:[
{ src:'//data.profitablegatetocontent.com/c6/4b/7a/id.js'
}]
但是,由于我必须使用的脚本标记有点复杂,我感到困惑,任何帮助都将不胜感激。
发布于 2022-11-22 20:59:19
快去救人!
添加动态脚本标记的另一种方法是head()
。
例如,在默认布局中:
<script>
export default {
data() {
return {
title: 'Hello World!'
}
},
head() {
return {
title: this.title,
script: [
{
hid: '',
src: '',
defer: true,
type: '',
innerHTML: ,
callback: () => { }
}
],
meta: [
{
hid: 'description',
name: 'description',
content: 'My custom description'
}
]
}
}
}
</script>
https://stackoverflow.com/questions/73856120
复制相似问题