search

Home  >  Q&A  >  body text

javascript - How to use Umeng in vue?

I introduced Umeng into the head of index.html, and when using it, an error message was reported _czc is undefined

    

        <script>
              //声明_czc对象:
              var _czc = _czc || [];
              //绑定siteid,请用您的siteid替换下方"XXXXXXXX"部分
              _czc.push(["_setAccount", "1261730196"]);
        </script>
        <script type="text/javascript"> 友盟中复制的代码 </script>
        
        我要统计一个按钮的点击量
        add: function () {
          _czc.push([ '_trackEvent', '官网点击量', '官网点击量', '官网点击量' ])
        }
        
        结果报错说_czc未定义。请问我要怎么引入?
仅有的幸福仅有的幸福2753 days ago663

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-05-19 10:43:47

    If you are using webpack, you need to modify the configuration file
    /build/webpack.base.conf.js

    let webpackConfig = {
      externals: {
        "_czc": "_czc"
      }
      ...
    }

    reply
    0
  • Cancelreply