-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
49 lines (45 loc) · 1.16 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
48
49
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>learning-vue</title>
</head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
<!-- <script src="https://unpkg.com/vue-router/dist/vue-router.js"></script> -->
<body>
<div id="learning-vue">
<div>
<input-box ref="user-input"></input-box>
</div>
</div>
</body>
<script>
Vue.component('input-box', {
template: `<input />`
})
const app = new Vue({
// el: "#learning-vue",
data: {
name: 'qinhanwen'
},
})
// console.log(app.$refs['user-input'].$parent);
// console.log(app.$refs);
// console.log(app.$root);
// console.log(app.$data);
// console.log(app.$el);
// const unwatch = app.$watch('name', function (newVal) {
// console.log(newVal);
// }, {
// // immediate:true
// })
// app.name = "zeng";
// unwatch();
// app.name = "zeng1";
var MyComponent = Vue.extend({
template: '<div>$mount!</div>'
})
// 创建并挂载到 #app (会替换 #app)
new MyComponent().$mount('#learning-vue');
</script>
</html>