Skip to content

Commit 7dc7a97

Browse files
committed
js 基础知识
变量提升,区块,标签
1 parent 3d7e59c commit 7dc7a97

File tree

5 files changed

+71
-9
lines changed

5 files changed

+71
-9
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<title>语法</title>
9+
</head>
10+
11+
<body>
12+
13+
</body>
14+
<script>
15+
// 变量提升
16+
console.log(a);
17+
var a = 1
18+
19+
// var a;
20+
// console.log(a);
21+
// a = 1;
22+
23+
// js区块 不构成单独的作用域 区块往往用来构成其他更复杂的语法结构,比如for、if、while、function等
24+
{
25+
var b = 1;
26+
}
27+
28+
console.log(b);
29+
// 标签(label) 相当于定位符,用于跳转到程序的任意位置,标签的格式 label:statement
30+
</script>
31+
32+
</html>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
### 语法
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// var template = require('art-template');
2-
// $('#main_panel').html(template('main_panel_big_sale_template', data));
3-
// var list = document.getElementById('test');
4-
// list.html(template('testTmp', [1,2,4]))
1+
2+
// $('#test').html(template('testTmp', data));
3+
var list = document.getElementById('test');
4+
list.innerHTML = template('testTmp', [1,2,4]);

node和express/express/myapp/views/index.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
<h1>这是我的第一个express服务器端视图文件</h1>
1313
<h2>我的传递的参数title为:{{title}}</h2>
1414
<div id='test'>
15-
{{each list as value i}} {{value}} {{/each}}
15+
<!-- {{each list as value i}} {{value}} {{/each}} -->
1616
</div>
1717
</body>
18+
<script src="https://cdn.bootcss.com/template_js/0.7.1/template.min.js"></script>
1819
<script src="/javascripts/index.js">
1920
// var data = {
2021
// title: '标签',
@@ -24,8 +25,14 @@ <h2>我的传递的参数title为:{{title}}</h2>
2425
// document.getElementById('test').innerHTML = html;
2526
</script>
2627
<!-- 这里是如何使用模板 -->
27-
<script id="testTmp" type="text/html">
28-
29-
</script>
3028

31-
</html>
29+
</html>
30+
<script id="testTmp" type="text/html">
31+
<div>
32+
<ul>
33+
<li>
34+
{{each list as value i}} {{value}} {{/each}}
35+
</li>
36+
</ul>
37+
</div>
38+
</script>

node和express/npm-debug.log

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
0 info it worked if it ends with ok
2+
1 verbose cli [ 'C:\\node\\node.exe',
3+
1 verbose cli 'C:\\node\\node_modules\\npm\\bin\\npm-cli.js',
4+
1 verbose cli 'start' ]
5+
2 info using [email protected]
6+
3 info using [email protected]
7+
4 verbose stack Error: ENOENT: no such file or directory, open 'C:\Users\liyonglu\Desktop\myGithub\liyonglu123.github.io\node和express\package.json'
8+
4 verbose stack at Error (native)
9+
5 verbose cwd C:\Users\liyonglu\Desktop\myGithub\liyonglu123.github.io\node和express
10+
6 error Windows_NT 10.0.15063
11+
7 error argv "C:\\node\\node.exe" "C:\\node\\node_modules\\npm\\bin\\npm-cli.js" "start"
12+
8 error node v6.9.4
13+
9 error npm v3.10.10
14+
10 error path C:\Users\liyonglu\Desktop\myGithub\liyonglu123.github.io\node和express\package.json
15+
11 error code ENOENT
16+
12 error errno -4058
17+
13 error syscall open
18+
14 error enoent ENOENT: no such file or directory, open 'C:\Users\liyonglu\Desktop\myGithub\liyonglu123.github.io\node和express\package.json'
19+
15 error enoent ENOENT: no such file or directory, open 'C:\Users\liyonglu\Desktop\myGithub\liyonglu123.github.io\node和express\package.json'
20+
15 error enoent This is most likely not a problem with npm itself
21+
15 error enoent and is related to npm not being able to find a file.
22+
16 verbose exit [ -4058, true ]

0 commit comments

Comments
 (0)