-
Notifications
You must be signed in to change notification settings - Fork 235
/
Copy pathtest-v3.html
39 lines (39 loc) · 859 Bytes
/
test-v3.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
<div id="app">
<h1>{{ title }}</h1>
<parent></parent>
</div>
<script src="https://unpkg.com/vue@3"></script>
<script>
const { createApp } = Vue
createApp({
data() {
return {
title: '父组件和子组件创建和挂载顺序'
}
},
components: {
parent: {
name: 'parent',
template: '<div>parent: <child /></div>',
created() {
console.log('parent created');
},
mounted() {
console.log('parent mounted');
},
components: {
child: {
name: 'child',
template: '<div>child</div>',
created() {
console.log('child created');
},
mounted() {
console.log('child mounted');
},
}
}
}
}
}).mount('#app')
</script>