index.html
2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!--
* @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>