修复Global_JS 不被执行的bug

This commit is contained in:
tangly1024.com
2024-04-28 15:45:46 +08:00
parent 2248f7484f
commit 87b66e9f44

View File

@@ -152,12 +152,16 @@ const ExternalPlugin = props => {
}
useEffect(() => {
// 异步渲染谷歌广告
if (ADSENSE_GOOGLE_ID) {
setTimeout(() => {
// 异步渲染谷歌广告
initGoogleAdsense()
}, 1000)
}
// 执行注入脚本
// eslint-disable-next-line no-eval
eval(GLOBAL_JS)
}, [])
if (DISABLE_PLUGIN) {
@@ -206,16 +210,6 @@ const ExternalPlugin = props => {
</>
)}
{/* 注入JS脚本 */}
{GLOBAL_JS && (
<script
async
dangerouslySetInnerHTML={{
__html: GLOBAL_JS
}}
/>
)}
{CHATBASE_ID && (
<>
<script