2***@qq.com
2***@qq.com
  • 发布:2020-03-02 15:26
  • 更新:2023-09-22 16:42
  • 阅读:4321

uni-app打包之后多了一个请求

分类:HBuilderX

打包之后多了一个图片请求
Request URL: https://cdn.dcloud.net.cn/img/shadow-grey.png
导致谷歌广告投放失败,怎么解决

2020-03-02 15:26 负责人:无 分享
已邀请:
DCloud_uniAD_HDX

DCloud_uniAD_HDX

请提供投放失败的详细信息

  • 2***@qq.com (作者)

    I have checked your website with our internal tool, finding that your website 8675787933 contains bad links and I may give those link by the followings:

    Malware Link :

    https://cdn.dcloud.net.cn/img/shadow-grey.png

    I may suggest you to firstly contact your webmaster remove those bad links from your website and try to remove the template, plug-in, scripts or any part related to unsafe domain. Once you already complete the mentioned process, kindly reply back with the evidence or screenshot from the tools you have checked to this email for further escalation.

    2020-03-03 10:12

  • 2***@qq.com (作者)

    谷歌认为这是恶意脚本

    2020-03-03 10:13

  • DCloud_heavensoft

    回复 2***@qq.com: 这个问题很奇怪。1、你可以向谷歌申诉,说这是一张阴影图片,不涉及任何安全问题。2、确认下,你到底是哪个平台有问题,是h5平台吗?

    2020-03-03 18:51

  • 2***@qq.com (作者)

    回复 DCloud_heavens在h5平台,谷歌认为是恶意脚本,根本不给通过,我把导航栏禁止了,打包还有这个阴影

    2020-03-04 09:44

  • DCloud_heavensoft

    回复 2***@qq.com: 先在编译后的代码里,手动删除这个图片的引用吧。我们后续提供一个简单的方法

    2020-03-05 17:37

DCloud_heavensoft

DCloud_heavensoft

shadow-grey.png 是导航栏下面的阴影线。如果没用,可以删除

  • 2***@qq.com (作者)

    我没有使用导航栏组件,在哪里删除,项目中没有使用,打包过后自动有了

    2020-03-03 10:15

  • 2***@qq.com (作者)

    导航栏我都禁止了

    2020-03-03 16:53

DCloud_uniAD_HDX

DCloud_uniAD_HDX

这个图片是阴影效果预加载加速显示用的,如果不需要参考下面的配置

H5 平台:在起始页 html 文件中添加下面代码,参考 manifest H5 index.html 模板配置

<head>  
...  
<link rel="stylesheet" href="<%= BASE_URL %>static/index.css" />  
<style>  
    body::after {  
        content: none;  
    }  
</style>  

</head>
  • 2***@qq.com (作者)

    多谢

    2020-03-06 09:54

  • u***@protonmail.com

    没作用呀。大哥。我用的脚手架vite

    "vue": "^3.3.11",

    "vite": "4.3.5"

    2024-04-18 22:16

2***@qq.com

2***@qq.com (作者)

在线上代码中 ```<style>
body::after {
content: none;
}
</style>



  • DCloud_UNI_GSQ

    你加错位置了,放到官方样式之下啊。样式是后面的覆盖前面的。

    2020-05-07 16:53

2***@qq.com

2***@qq.com (作者)

线上代码已经加上这段代码,缓存已清,但是并未生效,和hbuildx的版本有关吗,我使用的是2.1.3版本

  • ippz

    想办法解决了吗?我也遇到这种问题,官方提供不行~

    2020-04-29 11:51

danleung

danleung

线上代码已经加上这段代码,缓存已清,提交了,谷歌还是说有恶意软件,

  • DCloud_uniAD_HDX

    是接入了Google的H5广告吗?联系技术支持QQ:87263426

    2022-06-13 10:40

DCloud_UNI_GSQ

DCloud_UNI_GSQ

把 css 放到 head 最下面部分。

  • mmonke

    这个方式可以解决

    2022-09-06 11:02

k***@outlook.com

k***@outlook.com - 路遥知马力日久见人心

请问最后解决了吗?
具体解决方案方便提供一下吗?

  • goper

    歪个楼,大佬.h5怎么写装饰器,步骤是什么, 租界内```

    methods: {


            //测试函数  
    testClick(){
    @t();}

    }


    2023-07-07 14:03

m***@yeah.net

m***@yeah.net

可以使用自定义插件在编译后的文件中删除cdn资源引用源码的方式解决:
在根目录添加 "vue.config.js" 文件并配置以下代码:

module.exports = {  
  configureWebpack: (config) => {  
    // 编译后删除css文件里自带的uni-app资源引用  
    config.plugins.push(function (compiler) {  
      const pathReg = /\s*background(-image)?:\s*url\(\S*?\/\/[\w\.-]*?dcloud.net.cn\S*?\);?[ \t]*/gi  
      const eachReplace = (dirPath) => {  
        fs.readdirSync(dirPath, { withFileTypes: true }).forEach(dirent => {  
          const filePath = path.join(dirPath, dirent.name)  
          if (dirent.isDirectory()) {  
            eachReplace(filePath)  
          } else if (dirent.isFile() && /.(c|ac|wx)ss$/.test(dirent.name)) {  
            try {  
              const fileData = fs.readFileSync(filePath, 'utf8')  
              if (pathReg.test(fileData)) {  
                fs.writeFileSync(filePath, fileData.replace(pathReg, ''), 'utf8')  
              }  
            } catch (e) {}  
          }  
        })  
      }  
      compiler.hooks.done.tap('removeUniCdnPath', eachReplace.bind(null, process.env.UNI_OUTPUT_DIR))  
    })  
  }  
}
  • m***@yeah.net

    使用此方法除生产编译或小程序模式外,启动H5模式的dev本地服务时可能会有问题,建议用 if (process.env.NODE_ENV === 'production' || process.env.UNI_PLATFORM !== 'h5') { ... } 包裹执行的代码。

    2023-09-05 21:05

lihuifang

lihuifang

我已经加了,为啥打包出来还是有? 我是vue3

要回复问题请先登录注册