-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdemo.html
34 lines (34 loc) · 981 Bytes
/
demo.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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
#content {
width: 650px;
}
</style>
</head>
<body>
<h1>请打开控制台</h1>
<form action="">
<label for="content">请输入模板</label>
<input id="content" type="text" value='<div id="app"><span>{{message}}</span></div>'>
<button id="btn">确定</button>
</form>
<script src="./vue-ast.js"></script>
<script>
var btn = document.getElementById("btn");
btn.onclick = function (e) {
var template = document.getElementById("content").value;
var ast = new Parse(template);
console.log("转化成的AST树为:");
console.log(ast);
e.preventDefault();
}
</script>
</body>
</html>