19-08-04 getComputedStyle npm-run-lint

190 阅读1分钟

获取css属性真实渲染值

  1. obj.style:这个方法只能只能获取写在html标签中的写在style属性中的值,而无法获取定义在<style type="text/css">里面的属性
  2. document.defaultView.getComputedStyle(dom, fakeDom): 这个方法接受两个参数:要取得计算样式的元素和一个伪元素字符串(例如:after)。如果不需要伪元素信息,第二个参数可以是nullgetComputerStyle()方法返回一个CSSStyleDeclaration对象,其中包含当前元素的所有计算后的样式。ie下为currentStyle

npm run lint 自动修复代码中不合规的格式

进度

www.bilibili.com/video/av459…