UNPKG

vue-virtualized-table-booway

Version:

The second version of implementation of `vue-virtual-table` component, it was inspired from [rc-table](https://github.com/react-component/table) and [ant-table](https://ant.design/components/table), API design is 60%+ consistent. Or you could think I tran

45 lines (33 loc) 1.09 kB
/* Forked from `https://github.com/react-component/util/edit/master/src/getScrollBarSize.js` */ let cached export default function getScrollBarSize(fresh) { if (typeof document === "undefined") { return 0 } if (fresh || cached === undefined) { const inner = document.createElement("div") inner.style.width = "100%" inner.style.height = "200px" const outer = document.createElement("div") const outerStyle = outer.style outerStyle.position = "absolute" outerStyle.top = 0 outerStyle.left = 0 outerStyle.pointerEvents = "none" outerStyle.visibility = "hidden" outerStyle.width = "200px" outerStyle.height = "150px" outerStyle.overflow = "hidden" outer.appendChild(inner) document.body.appendChild(outer) const widthContained = inner.offsetWidth outer.style.overflow = "scroll" let widthScroll = inner.offsetWidth if (widthContained === widthScroll) { widthScroll = outer.clientWidth } document.body.removeChild(outer) cached = widthContained - widthScroll } return cached }