前端基础知识
unique_Fly
这个作者很懒,什么都没留下…
展开
-
前端跨域方式
同源请求: Ajax, fetch… 非同源请求(跨域): 1.JSONP (server端通过JSON.stringify返回数据),只支持GET请求 2.CORS(跨域资源共享):需要server端设置responseHeader相关参数, 支持所有类型的请求,但是Access-Control-Allow-Origin设置多个值时无法设置cookie和session 3.基于webpack dev server的proxy代理 4.server端设置nginx代理 5.使用HTML5的postMessa原创 2020-08-11 18:34:44 · 96 阅读 · 0 评论 -
JS常见模块开发规范(CommonJS、AMD、CMD 以及 ES6 模块加载)
模块使用方式 CommonJS :require 引用模块 module.exports 暴露接口 AMD:require 引用模块 使用 define 函数的 return 暴露接口 CMD:require 引用模块 module.exports 或 exports 暴露接口 ES6:import 引用模块 export default 暴露接口 模块加载方式 CommonJS :运行时加载,一个模块就是一个对象,加载一.原创 2020-08-10 11:24:02 · 143 阅读 · 0 评论 -
js相关
js代码执行顺序:script(主程序代码)——>process.nextTick——>promise——>setTimeout js严格模式下的不同: 不允许不使用 var 关键字去创建全局变量,抛出 ReferenceError 不允许对变量使用 delete 操作符,抛 ReferenceError 不可对对象的只读属性赋值,不可对对象的不可配置属性使用 delete 操作符,不可为不可拓展的对象添加属性,均抛 TypeError 对象属性名必须唯一 函数中不可有重名参数 在函数内部原创 2020-07-03 16:59:02 · 117 阅读 · 0 评论 -
css居中
css使得div居中 方式一:{margin: 0 auto;} 方式二:{ position: absolute;left: 50%; top: 50%; margin-top: -(height/2); margin-left: -(width/2);} 方式三:写死的margin或者padding挤到中间(这样不同浏览器下可能会出问题) ...原创 2020-07-01 16:13:31 · 58 阅读 · 0 评论 -
css选择器
CSS选择器笔记css选择器种类css可继承属性css不可继承属性选择器优先级 css选择器种类 类选择器,id选择器,标签选择器,属性值选择器,相邻选择器,子选择器, 后代选择器,通配符选择 器,伪类选择器 css可继承属性 font-size,font-family,color css不可继承属性 border,padding,margin,width,height 选择器优先级 !important > 内联 > id > class > tag标签 ...原创 2020-07-01 15:58:13 · 94 阅读 · 0 评论