个人知识体系梳理

这篇博客探讨了JavaScript的闭包、数组和函数等核心概念,以及在Vue.js框架中组件、渲染函数和Vuex状态管理的应用。同时,涉及了浏览器的localStorage和sessionStorage、事件监听及Ajax、fetch和axios在数据交互中的使用,深入讲解了Promise和async/await的异步处理。文章还提到了模板字符串、let和const等ES6特性,并对比了传统XMLHttpRequest与现代Ajax请求的区别。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

string

Array

Function

闭包

优点

缺点

Storage

localStorage

sessionStorage

BOM

DOM

addEventListener

给制定元素添加事件句柄

生命周期

component

render函数

指令

vuex

vue-router

hash

带锚点

history

Promise

await

箭头函数

模板字符串

let、const

浏览器

打开页面

记录的比较详细

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) {

       }
   });

axios

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值