随笔分类 - 面试题
摘要:
https://juejin.cn/post/6850418115042836487 https://blog.csdn.net/double_sweet1/article/details/122786636?utm_medium=distribute.pc_aggpage_search_resul
阅读全文

摘要:
跨域出现的原因,是因为浏览器的同源策略导致,即 协议 域名 端口号 不一致, 如何解决 代理服务器 nginx 使用代理服务,帮助我们请求接口,在响应回来给到浏览器 jsonp 利用 script 标签,天然跨域特性 ,仅支持 get CORS 服务器端开启 CORS proxy 代理 等
阅读全文

摘要:
如何确定首屏加载时间? 首屏时间的定义: 浏览器显示第一屏页面所消耗的时间,以 800x600 像素尺寸为标准,从开始加载到浏览器页面显示高度达到 600 像素且此区域有内容显示的时间。 也就是说用户能够看到区域内所有元素加载完的时间。 一个页面的“总加载时间”要比“首屏时间”长,但对于最终用户体验
阅读全文

摘要:
方式一:padding + 百分比 <style> html, body { margin: 0; padding: 0; } .outer { width: 20%; height: 0; padding-bottom: 20%; background-color: red; } </style>
阅读全文

摘要:
1. arr.filter(Boolean) 的结果是 [0, 1, 2, 3, -1, null, "", 3, 5, 7].filter(Boolean); 等同与 [0, 1, 2, 3, -1, null, "", 3, 5, 7].filter((item) => Boolean(item
阅读全文

摘要:
需求讲解 画一个矩形,拖拽矩形的4个角可以将矩形缩放(缩小到顶点时,顶点需要固定),在矩形上按住拖动,可以移动该矩形的位置 <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" conten
阅读全文

摘要:
Less是CSS预处理语言,扩展了CSS语言,增加了变量、Mixin、函数等特性,Less-loader的作用就是将less代码转译为浏览器可以识别的CSS代码。 // demo.less @base: #f938ab; .box-shadow(@style, @c) when (iscolor(@
阅读全文

摘要:
var timer; var i = 1; timer = function () { i++; console.log(i); if (i 10) { timer = function () { console.log("终止运行"); } } setTimeout(timer, 3000); }
阅读全文

摘要:
十种跨域解决方案 https://juejin.cn/post/6844904126246027278#heading-33
阅读全文

摘要:
题目要求 查询触发条件 搜索框敲击回车 点击“Search”按钮 查询中,显示“Loading” 查询无结果时,显示“查无结果” 滚动列表时,支持懒加载 <!-- page页面 --> <template> <div class="search-container"> <input type="te
阅读全文

摘要:
题目要求 左侧:宽度固定150px,高度自动撑开,和右侧同高 右侧:宽度自适应,高度自动撑开,和左侧同高 代码实现 <div class="container"> <div class="left"></div> <div class="right"></div> </div> body{ marg
阅读全文

摘要:
/** * 版本比较 * @param {*} a * @param {*} b */ function compare(a, b) { let arr1 = a.split('.'); let arr2 = b.split('.') const maxLength = Math.max(arr1.
阅读全文

摘要:
题目要求 实现一个方法sameNumbers,找出同时存在于两个数组的所有数字 需要处理异常传参,情况不限于: 未传入arr1或arr2 arr1或arr2不是数组 字符串格式的数字需要转为数字,如:'1'需先转化为1再进行查重比较 返回结果需要过滤所有非数字项 代码实现 // 思路:给 obj 新
阅读全文

摘要:
如何让一个浮动元素水平居中 最简单的办法,向右推移50%,然后在平移自身宽度的一半 .box{ width: 700px; height: 400px; border: 1px solid #000; } .con{ width: 200px; height: 100px; float: left;
阅读全文

摘要:
粘连布局 所谓粘连布局就是当内容容器没有超出时,footer是紧贴咋底部的,当内容超出的时候,footer紧随在内容容器之后,并不会超出容器。 OK,我们来看一副图,来了解粘连布局的效果 方法一 min-height: 设置最小高度,用于挤开footer,margin-top:-100px;使foo
阅读全文
