-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
47 lines (47 loc) · 1.47 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>QDog.js test</title>
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-default/index.css">
</head>
<body class="lang-zh">
<h1>QDog.js</h1>
<div id="app">
<el-button @click="visible = true">按钮</el-button>
<el-dialog v-model="visible" title="Hello world">
<p>欢迎使用 Element</p>
</el-dialog>
</div>
<script src="https://unpkg.com/vue"></script>
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
const getComponentPath = function(comp) {
const path = [comp.$options.name || '*'];
let parent = comp;
while (parent = parent.$parent) {
path.unshift(parent.$options.name || '*');
}
return `${comp._uid}:` + path.join(' > ');
};
Vue.mixin({
beforeCreate: function () {
console.log(`[BEFORE_CREATED][${performance.now()}] ${getComponentPath(this)}.`);
},
created: function () {
console.log(`[CREATED][${performance.now()}] ${getComponentPath(this)}.`);
}
});
new Vue({
el: '#app',
data: function(){
return { visible: false }
}
});
</script>
</body>
</html>