当前位置: 首页 > Web前端 > CSS

2019年6月遇到的知识点整理

时间:2023-03-30 14:57:03 CSS

*注:本文是工作中遇到的知识点整理,涉及的东西价格比较比较乱。如有错误,欢迎指正和指导。1.前端其实我对网关不是很了解。收集了两个网站:前端学习HTTP的网关,隧道和中继了解WEBAPI网关。公司把一个大项目拆分成很多微服务,每个微服务有不同的独立服务器,集成的时候使用Nginx转发。Nginx技术暂时还没有学习,暂时放在这里2.字符串处理项目中用到了字符串处理。我想系统地组织这个方法。示例concat组合文本的两个或多个字符并返回一个新的字符串示例:vara="hello";varb=",world";varc=a.concat(b);alert(c);//c="hello,world"indexOf返回指定字符在字符串中指定位置开始后该字符串第一次出现的位置。如果找到,则返回相应的位置。如果没有找到,返回-1str.indexOf(m,n);m:要搜索的字符(字符串);n:开始搜索的位置。例子:varindex1=a.indexOf("l");//index1=2varindex2=a.indexOf("l",3);//index2=3length得到字符串的长度varlen=a.length();//len=5charAt返回指定索引处的字符str.charAt(n);n:指定位置。示例:varget_char=a.charAt(0);//get_char="h"console.log(a);//'hello'charCodeAt返回指定索引处的unicode字符str.charCodeAt(n);n:指定位置。例子:a.charCodeAt(0);//104lastIndexOf返回字符串中最后一次出现子串的索引(从右到左搜索),如果没有匹配,返回-1varindex1=lastIndexOf('l');//index1=3varindex2=lastIndexOf('l',2)//index2=2match检查一个字符串是否匹配正则表达式,如果不匹配则返回null。varre=newRegExp(/^w+$/);varis_alpha1=a.match(re);//is_alpha1="hello"varis_alpha2=b.match(re);//is_alpha2=nullsubstring返回一个字符串Substring,传入的参数是开始位置和结束位置。varsub_string1=a.substring(1);//sub_string1="ello"varsub_string2=a.substring(1,4);//sub_string2="ell"substr返回字符串的子串,传入参数为起始位置和长度。varsub_string1=a.substr(1);//sub_string1="ello"varsub_string2=a.substr(1,4);//sub_string2="ello"replace用于查找匹配正则表达式的字符串,然后用新字符串替换匹配的字符串。varresult1=a.replace(re,"Hello");//result1="Hello"varresult2=b.replace(re,"Hello");//result2=",world"search执行正则表达式匹配查找.如果查找成功,则返回字符串中匹配项的索引。否则返回-1。varindex1=a.search(re);//index1=0varindex2=b.search(re);//index2=-1slice提取部分字符串,返回一个新的字符串(同substring)。varsub_string1=a.slice(1);//sub_string1="ello"varsub_string2=a.slice(1,4);//sub_string2="ell"split通过将字符串分成子串,将一个字符串做成一个字符串数组。vararr1=a.split("");//arr1=[h,e,l,l,o]toLowerCase将整个字符串转换为小写字母。varlower_string=a.toLowerCase();//lower_string="hello"toUpperCase将整个字符串转为大写字母。varupper_string=a.toUpperCase();//upper_string="HELLO"3.Web前端测试相关收藏链接,Web前端测试指南4.inputtype='file'去掉提示文字"Nofileselected”和settingCursor:pointerinvalid问题1,其实文件上传控件的悬浮提示是input的title属性,所以可以手动给input的title设置一个空格,即title=”“。2.游标:指针无效。只需设置输入填充值。五、select的placeholderselect没有placeholder属性,所以用option隐藏这个选项六、跨域问题跨域问题经常被前端问到。各种网站上也有很多文章。收藏一篇很详细的文章就行,不要问我跨域的问题。6.对象被复制但互不影响。本质上就是要做深拷贝。