js
string
Array
Function
闭包
优点
缺点
Storage
localStorage
sessionStorage
BOM
DOM
addEventListener
给制定元素添加事件句柄
vue
生命周期
component
render函数
指令
vuex
vue-router
hash
带锚点
history
ES6
Promise
await
箭头函数
模板字符串
let、const
NodeJs
浏览器
打开页面
cookie 监听
数据对接
工具
XMLHttpRequest
var xhr=new XMLHttpRequest();
xhr.open("post","http://127.0.0.1/adv");
xhr.send(formdata);
xhr.onload=function(){
if(xhr.status==200){
//...
}
}
Ajax
const parm = {
username: "yh",
password: "yh",
uuid: "id",
};
$.ajax({
type: "POST",
url: "http://xzxz",
contentType: "application/json",
data: JSON.stringify(parm),
dataType: "json", // 返回的数据类型 json
success: function (d) {
//...
},
});
fetch
const formData = new FormData();
// 将"ID=1&signal=value"形式封装成FormData形式
formData.append("Id", '1');
formData.append("signal", 'value');
fetch(this.api, {
method: 'post',
body: formData,
headers: {
'Content-Type': 'application/json;charset=UTF-8',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': '*',
'Access-Control-Allow-Methods': 'GET,PUT,POST,DELETE,OPTIONS',
tk: localStorage.getItem('tk'),
},
}).then(res => res.json())
.then((response) => {
if (response) {
}
});