index.html 2.97 KB
<!--
 * @Author: yangming yangming@didihu.com.cn
 * @Date: 2023-11-24 17:29:53
 * @LastEditors: yangming yangming@didihu.com.cn
 * @LastEditTime: 2023-12-20 22:26:08
 * @FilePath: \rollup_demo\public\index.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div data-gl-tracker>1</div>
    <p>123</p>
    <div>1</div>
    <div>1</div>
    <div>1</div>
    <div>1</div>
    <div>1</div>
    <div class="test">TEST</div>
    <div>
      <button class="class" name="name" id="id">111</button>
    </div>
    <div id="app">
      <h1>Hello App!</h1>
      <p>
        <!-- use router-link component for navigation. -->
        <!-- specify the link by passing the `to` prop. -->
        <!-- `<router-link>` will be rendered as an `<a>` tag by default -->
        <router-link to="/foo">Go to Foo</router-link>
        <router-link to="/bar">Go to Bar</router-link>
        <button>点击</button>
      <div class="aaa"><div id="testp">44</div></div>
      </p>
      <!-- route outlet -->
      <!-- component matched by the route will render here -->
      <router-view></router-view>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.14"></script>
  <script src="https://cdn.bootcdn.net/ajax/libs/vue-router/3.1.0/vue-router.min.js"></script>
  <script src="../dist/glsx-tracker-javascript.umd.js"></script>
  <script>
    const tracker = new Tracker()
    tracker.setAttribute({phone:19999999})
    tracker.login('18888888')
    tracker.setCommonAttribute({
      username:'444'
    })
    document.querySelector('.test').addEventListener('click', function (e) {
      tracker.track(
        this,
        {
          aaa: 999
        },
        function () {
          console.log('t')
        }
      )
    })
  </script>
  <script>
    const Foo = { template: "<div>foo</div>" };
const Bar = { template: "<div>bar</div>" };

// 2. Define some routes
// Each route should map to a component. The "component" can
// either be an actual component constructor created via
// `Vue.extend()`, or just a component options object.
// We'll talk about nested routes later.
const routes = [
  { path: "/foo", component: Foo },
  { path: "/bar", component: Bar },
];

// 3. Create the router instance and pass the `routes` option
// You can pass in additional options here, but let's
// keep it simple for now.
const router = new VueRouter({
  routes, // short for `routes: routes`
});
router.beforeEach(function (to, from, next) {
  //console.log('url1:', document.URL);
  setTimeout(function () {
    //console.log('url2:', document.URL);
    // tracker.autoTriggerView({
    //   aa:11
    // })
    next();
  }, 0);
});
const app = new Vue({
  router,
}).$mount("#app");
  </script>

  </body>
</html>