摘要: 单行省略 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; 多行省略 display:-webkit-box; overflow: hidden; text-overflow: ellipsis; -webkit-box- 阅读全文
posted @ 2023-01-31 16:39 胡姐姐 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 一、执行上下文类型: 1、全局上下文 一直存在,直到页签关闭或者浏览器关闭。 2、函数上下文 存在函数执行期间。 3、特殊上下文:eval执行时上下文 二、作用域 ● 全局作用域 ● 函数作用域 ● 块级作用域 ● 动态作用域(call,apply等修改this指向) 1、【作用域】规定了变量的作用 阅读全文
posted @ 2022-12-22 15:44 胡姐姐 阅读(69) 评论(0) 推荐(0) 编辑
摘要: 一、前提: ● IE浏览器 ● 微软输入法 ● 输入中文,输入结束,敲下空格键 二、现象: 无法通过change事件获取最新的中文值 三、解决方案: 监听compositionEnd事件,在compositionEnd事件里拿最新的值 阅读全文
posted @ 2022-12-19 09:18 胡姐姐 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 一、前提: ● 360浏览器 (其他浏览器未出现此问题) ● 微软输入法 ● 拼音输入 ● 连续输入同个字母 二、现象: 三、解决方案: 在文本框的onCompositionEnd方法处判断长度是否大于50,是则手动截取前50个; const handleCompositionEnd = () => 阅读全文
posted @ 2022-12-17 16:36 胡姐姐 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 原因: 1、window.onload事件在异步回调里定义 2、在定义window.onload事件之前,浏览器的资源已经加载完了。 示例1: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equi 阅读全文
posted @ 2022-12-16 10:37 胡姐姐 阅读(807) 评论(0) 推荐(0) 编辑
摘要: 一、前提条件: 微软输入法 关键原因 输入中文 有对输入内容做控制,只允许输入中文和数字和英文 二、问题现象: 三、解决方案: 对中文的处理放在compositionend事件里,其余数字和英文的处理在change事件 3.1解决之后的现象: 3.2 代码 React版解决示例 /* * Demo 阅读全文
posted @ 2022-12-14 10:53 胡姐姐 阅读(114) 评论(0) 推荐(0) 编辑
摘要: yarn --registry=http://registry.npmmirror.com npm install --registry=http://registry.npmmirror.com 阅读全文
posted @ 2022-12-12 15:33 胡姐姐 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 一、偏移尺寸 偏移尺寸的计算是相对于【包含元素】,包含元素指offsetParent( offsetParent 不一定是 parentNode ) 如何确定一个元素的offsetParent? 元素自身有fixed定位,父元素不存在定位,则offsetParent的结果为null(firefox中 阅读全文
posted @ 2022-12-09 15:58 胡姐姐 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 有可能是没安装 EditorConfig for VS Code 插件,看项目是否有.editorconfig文件,有则不需要再做其他操作,ctrl + S 保存一下文件就可以切换了。 没有则需要再项目根目录下新建.editorconfig文件。内容如下: # http://editorconfig 阅读全文
posted @ 2022-12-09 10:44 胡姐姐 阅读(1828) 评论(0) 推荐(0) 编辑
摘要: 1、git log查看commit情况,找到红色标记的commit 2、git reset --mixed xxx到红色commit的位置,重新commit,然后直接推git push origin HEAD:refs/for/分支名,不用再拉代码。 阅读全文
posted @ 2022-12-09 10:42 胡姐姐 阅读(668) 评论(0) 推荐(0) 编辑
摘要: 闭包是什么? | 来源 | 描述 | | | | | JavaScript高级程序设计 | 闭包指的是那些引用了另一个函数作用域中变量的函数,通常是在嵌套函数中实现的。 | | JavaScript权威指南 | 函数对象可以通过作用域链相互关联起来,函数体内部的变量都可以保存在函数作用域内,这种特性 阅读全文
posted @ 2022-08-06 17:30 胡姐姐 阅读(36) 评论(0) 推荐(1) 编辑
摘要: 总结 font-size:10px; -ms-transform:scale(1);/* IE */ -webkit-transform:scale(0.83);/* chrome */ -moz-transform:scale(1);/* firefox */ -o-transform:scale 阅读全文
posted @ 2022-05-11 15:02 胡姐姐 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 知识点: 案例效果图: 代码: <!DOCTYPE html> <html lang="en"> <head> <style> *{ margin: 0; padding: 0; } .controlls { display: flex; justify-content: space-around; 阅读全文
posted @ 2022-04-29 23:24 胡姐姐 阅读(22) 评论(0) 推荐(0) 编辑
摘要: 知识点: 案例: 实例代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewpo 阅读全文
posted @ 2022-04-25 10:44 胡姐姐 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 自己定义的React组件Label Label.tsx interface IProps{ ref:any; } const Label = ({ref}:IProps) => { return <div ref={ref}>标签</div> } 希望拿到Label组件的实例. 然而报错:Funct 阅读全文
posted @ 2022-04-24 17:11 胡姐姐 阅读(424) 评论(0) 推荐(0) 编辑
摘要: 解决方法 npm i html-webpack-plugin@next -D 阅读全文
posted @ 2020-11-19 21:47 胡姐姐 阅读(1572) 评论(2) 推荐(3) 编辑
摘要: 居中要点 1.该行内的所有元素 display:inline-block; line-height: xx; vertical-align: middle; 2.例子 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>好哇好哇</ 阅读全文
posted @ 2020-11-07 16:30 胡姐姐 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-10-31 23:48 胡姐姐 阅读(138) 评论(0) 推荐(0) 编辑
摘要: javaScript高级程序设计搬来的 class BrowserDetector { constructor() { // 测试条件编译 // IE6~10 支持 this.isIE_Gte6Lte10 = /*@cc_on!@*/false; // 测试 documentMode // IE7~ 阅读全文
posted @ 2020-10-17 22:35 胡姐姐 阅读(78) 评论(0) 推荐(1) 编辑
摘要: 字符串截取 1、汉字 /* 一个一个提取汉字到数组里*/ var reg = /\p{sc=Han}/gu; /* 判断是否只含有汉字,标点符号,空格*/ var reg = /^[\p{sc=Han}\s\p{P}]+$/gu; 2、其他 /* 截取零件号(数字) */ var reg = /\d 阅读全文
posted @ 2020-09-04 22:51 胡姐姐 阅读(292) 评论(0) 推荐(1) 编辑