-
Notifications
You must be signed in to change notification settings - Fork 0
/
6demo.html
58 lines (44 loc) · 1.27 KB
/
6demo.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
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>vue 6demo</title>
<script src="./js/vue.js"></script>
</head>
<body>
<div id="app">
<table>
<!-- 标签正确嵌套组件使用 is -->
<tr @click.native="show" is="my-header"></tr>
</table>
<!-- <my-header></my-header> -->
</div>
<script>
var vm3 = new Vue({
el: "#app",
data: {
},
components: {
"my-header": {
template: `<h2 >hello myHeader</h2>`,
data: function () {
return {
}
},
}
},
methods: {
show: function() {
console.log("show")
}
},
})
// 正确的嵌套方式与 is 属性
// 单向数据流
// 数据的作用域
// 原生事件 .native
// $refs this.$refs.myTitle.innerHTML = str // DOM 操作,非常特殊的情况下使用,数据较难修改的时候
</script>
</body>
</html>