forked from mqyqingfeng/Blog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ed1bd7
commit b459941
Showing
22 changed files
with
2,390 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>ES6</title> | ||
</head> | ||
<body> | ||
<h1>Content</h1> | ||
<script src="vender/main.js" type="module"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
console.log('加载了 add 模块') | ||
|
||
var add = function(x, y) { | ||
return x + y; | ||
}; | ||
|
||
export {add} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import {add} from './add.js'; | ||
console.log(add(1, 1)) | ||
|
||
import {square} from './square.js'; | ||
console.log(square(3)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
console.log('加载了 multiply 模块') | ||
|
||
var multiply = function(x, y) { | ||
return x * y; | ||
}; | ||
|
||
export {multiply} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
console.log('加载了 square 模块') | ||
|
||
import {multiply} from './multiply.js'; | ||
|
||
var square = function(num) { | ||
return multiply(num, num); | ||
}; | ||
|
||
export {square} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
console.log('加载了 add 模块') | ||
|
||
var add = function(x, y) { | ||
return x + y; | ||
}; | ||
|
||
module.exports.add = add; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var add = require('./add.js'); | ||
console.log(add.add(1, 1)) | ||
|
||
var square = require('./square.js'); | ||
console.log(square.square(3)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
console.log('加载了 multiply 模块') | ||
|
||
var multiply = function(x, y) { | ||
return x * y; | ||
}; | ||
|
||
module.exports.multiply = multiply; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
console.log('加载了 square 模块') | ||
|
||
var multiply = require('./multiply.js'); | ||
|
||
|
||
var square = function(num) { | ||
return multiply.multiply(num, num); | ||
}; | ||
|
||
module.exports.square = square; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>require.js</title> | ||
</head> | ||
<body> | ||
<h1>Content</h1> | ||
<script data-main="vender/main" src="vender/require.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
define(function() { | ||
|
||
console.log('加载了 add 模块') | ||
|
||
var add = function(x, y) { | ||
return x + y; | ||
}; | ||
|
||
return { | ||
add: add | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require(['./add', './square'], function(addModule, squareModule) { | ||
console.log(addModule.add(1, 1)) | ||
console.log(squareModule.square(3)) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
define(function() { | ||
|
||
console.log('加载了 multiply 模块') | ||
|
||
var multiply = function(x, y) { | ||
return x * y; | ||
}; | ||
|
||
return { | ||
multiply: multiply | ||
}; | ||
}); |
Oops, something went wrong.