8000 parse · gitbu/learn-vue@2a90e14 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2a90e14

Browse files
author
buaiping
committed
parse
1 parent 1e3afb0 commit 2a90e14

File tree

5 files changed

+391
-2
lines changed

5 files changed

+391
-2
lines changed

.DS_Store

0 Bytes
Binary file not shown.

demo/.DS_Store

0 Bytes
Binary file not shown.

demo/指令/v-for.html

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
<script src="../../vue-dev/dist/vue.js"></script>
9+
<style>
10+
#container {
11+
height: 100px;
12+
width: 200px;
13+
border: 1px solid red;
14+
}
15+
</style>
16+
</head>
17+
<body>
18+
<div
19+
id="container"
20+
>
21+
<ul>
22+
<li v-for="(val, key, index) in obj">{{index}} {{key}}: {{val}}</li>
23+
</ul>
24+
<button @click="handleClick"></button>
25+
</div>
26+
<script>
27+
vm = new Vue({
28+
el: '#container',
29+
data() {
30+
return {
31+
obj: {
32+
name: 'xm',
33+
age: 18
34+
}
35+
}
36+
},
37+
methods: {
38+
handleClick() {
39+
this.a.b.m = 333;
40+
},
41+
},
42+
watch: {
43+
'a.b': function(newVal) {
44+
console.log('newVal',newVal)
45+
}
46+
}
47+
48+
})
49+
</script>
50+
51+
</body>
52+
</html>

docs/vue2/compile/parse/html-parser.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,4 +331,14 @@ export function parseHTML (html, options) {
331331
**attrs的内容:**
332332

333333
* name: 属性的key
334-
* value:属性的value
334+
* value:属性的value
335+
* start: 一个属性的开始位置
336+
* end: 一个属性的结束位置
337+
338+
**ASTElement**
339+
340+
* type: 标签类型
341+
* tag:标签名称
342+
* attrsList: 标签的属性列表
343+
* attrsMap: 标签的散列表
344+
* children: 子元素

0 commit comments

Comments
 (0)
0