# width

获取素节点宽度的像素数

box

import { width } from '@hui-pro/utils';
width(node, type);

提示

想同时获取 width、height 可使用 import { size } from '@hui-pro/utils'; 将以 object 类型返回 { width: 0, height: 0 }

# API

参数 说明 类型 默认值 可选值
node DOM 元素节点 Element - -
type 可选 获取的类型。
为空:content---等同于 jq:$.width()
inner:content + padding---等同于 jq:$.innerWidth()
outer:content + padding + border---等同于 jq:$.outerWidth()
box:content + padding + border + margin---等同于 jq:$.outerWidth(true)
scroll:滚动长度
String - 'inner','outer','box','scroll'