Coder Social home page Coder Social logo

Comments (16)

ChanJuanMei avatar ChanJuanMei commented on May 11, 2024

最后我把统计的代码放在 /vues/demo/index.vue这种位置居然成功了,作者大大能改进一下么,放在这里不太优雅

from grace-vue-webpack-boilerplate.

Thunf avatar Thunf commented on May 11, 2024

app\wechat\views_common\hook\baidu.html 里的代码检查一下,是不是没包<script>,示例文件里是这样的:

<script>
var _hmt = _hmt || [];
(function() {
    var hm = document.createElement("script");
    hm.src = "//hm.baidu.com/hm.js?1234567890";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();
</script>

from grace-vue-webpack-boilerplate.

ChanJuanMei avatar ChanJuanMei commented on May 11, 2024

包了的

from grace-vue-webpack-boilerplate.

ChanJuanMei avatar ChanJuanMei commented on May 11, 2024
<script type="text/javascript"> var _mtac = {"autoReport":0}; (function() { var mta = document.createElement("script"); mta.src = "http://pingjs.qq.com/xx.js?v2.0.4"; mta.setAttribute("xx", "xx"); mta.setAttribute("xx", "xx"); var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(mta, s); })(); </script>

from grace-vue-webpack-boilerplate.

Thunf avatar Thunf commented on May 11, 2024

看一下页面响应里(控制台 -> Network -> Doc - Response),有没有这段?
我跑了一下最新的服务和模板,没有问题呀...

from grace-vue-webpack-boilerplate.

ChanJuanMei avatar ChanJuanMei commented on May 11, 2024

有这段的。js也是可以请求到的

from grace-vue-webpack-boilerplate.

ChanJuanMei avatar ChanJuanMei commented on May 11, 2024

不过我不是最新的

from grace-vue-webpack-boilerplate.

ChanJuanMei avatar ChanJuanMei commented on May 11, 2024

代码里面我也没看到你引用过baidu.html这个文件呀

from grace-vue-webpack-boilerplate.

Thunf avatar Thunf commented on May 11, 2024

模板里引用顺序是:

  • layout.html 里 {% include "foothook.html" %}
  • foothook.html 里 {% include 'hook/baidu.html' %}

为了方便管理多种第三方脚本的,你跑一下模板看看能不能发出去?
按你说的,有这段,JS也可以请求到(说明hook这段运行了),那可能就是加载的脚本发送的问题了...

from grace-vue-webpack-boilerplate.

ChanJuanMei avatar ChanJuanMei commented on May 11, 2024

你说的这些我都试过了,无论这段js放在view下的哪个html都不行,但是放在vues下面的模块的index.vue就可以。我已经测试很多遍了

from grace-vue-webpack-boilerplate.

Thunf avatar Thunf commented on May 11, 2024

app\wechat\views_common\layout.html 中的 views_common 是你自己建的么?
server运行时,默认访问的是 views 目录下,确认一下:

  • 若在views目录下有文件通过相对地址引用views_common下的内容 ,views_common需要在 build/webpack.base.conf.js 里的 CopyWebpackPlugin 里配置拷贝到server中
  • 若不是以上情况,那么你需要更改的应该是 views 下的文件才对,server运行时,默认访问的是 views 目录

from grace-vue-webpack-boilerplate.

ChanJuanMei avatar ChanJuanMei commented on May 11, 2024

这里不能截图,我的目录是views\ _common\baidu.html,而layout是views\layout.html

from grace-vue-webpack-boilerplate.

ChanJuanMei avatar ChanJuanMei commented on May 11, 2024

layout.html引用的baidu.com在谷歌浏览器中可以看到代码运行了呢

from grace-vue-webpack-boilerplate.

Thunf avatar Thunf commented on May 11, 2024

那就是加载统计脚本的代码运行了,然后腾讯的JS也加载进来了,但是在后台看不到数据对吧。。。
所以你看的数据是PV还是其他一些数据。。。
猜测和 {"autoReport":0} 有关系。。。去掉试试?

参考最新版的MTA文档
H5接入指南 - MTA HTML5接入

// 初始化
MtaH5.init({
  ...
  "autoReport":0,//是否开启自动上报(1:init完成则上报一次,0:使用pgv方法才上报)
  ...
});

from grace-vue-webpack-boilerplate.

ChanJuanMei avatar ChanJuanMei commented on May 11, 2024

貌似还是不行呢。无论后面我能不能成功进来,都很感觉你哦,真是一个very nice的人呢,么么哒

from grace-vue-webpack-boilerplate.

ChanJuanMei avatar ChanJuanMei commented on May 11, 2024

image
大神,build这个项目的时候出现上面那个错误是因为什么啊

from grace-vue-webpack-boilerplate.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.