代码更新

This commit is contained in:
2022-08-25 11:00:54 +08:00
parent 26c90f894c
commit eed38ad91b
43 changed files with 58165 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>hello_react</title>
</head>
<body>
<!-- 准备好容器 -->
<div id="test"></div>
<!-- 引入react核心库 -->
<script type="text/javascript" src="../js/react.development.js"></script>
<!-- 引入react.dom用于支持dom操作 -->
<script type="text/javascript" src="../js/react-dom.development.js"></script>
<!-- 引入babel用于jsx转为js -->
<script type="text/javascript" src="../js/babel.min.js"></script>
<script type="text/babel">
const VDOM = <h1>hello,react</h1>
ReactDOM.render(VDOM,document.getElementById('test'))
</script>
</body>
</html>

View File

@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script type="text/javascript">
function Star(name,age) {
this.name = name
this.age = age
this.sing = function() {
console.log("我会唱歌")
}
Star.prototype.sing2 = function() {
console.log("我会唱歌2")
}
}
let zz = new Star('周舟','24');
let qx = new Star('覃炫','24');
// console.log(zz.sing === qx.sing)
// console.log(zz.sing2 === qx.sing2)
// console.log(zz.__proto__ === Star.prototype)
// console.log(Star.prototype.__proto__)
// console.log(Object.prototype.__proto__)
// console.log(zz)
// 扩展内置对象的方法
console.log(Array.prototype)
Array.prototype.sum = function() {
var sum = 0;
for (var i = 0; i < this.length; i++) {
sum += this[i]
}
return sum;
}
var arr = [1,2,3];
console.log(arr.sum())
</script>
</body>
</html>

View File

@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script type="text/javascript">
// 1.父构造函数
function Father(name,age) {
this.name = name;
this.age = age;
}
Father.prototype.money = function() {
console.log("赚钱")
}
// 2.子构造函数
function Son(name,age,ext) {
// 利用call方法 将子构造函数的实例指向父构造函数
Father.call(this,name,age)
this.ext = ext
}
// 3.继承父类中原型对象的方法
Son.prototype = new Father()
Son.prototype.school = function() {
console.log("上学")
}
let a = new Son("zz",13,"22");
console.log(a)
</script>
</body>
</html>

View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script type="text/javascript">
function fn2() {
var num = 10;
return function() {
console.log(num)
}
}
var f = fn2();
f();
</script>
</body>
</html>