vuikit
Version:
A Vuejs component library based on UIkit
29 lines (24 loc) • 488 B
JavaScript
/**
* Vuikit 0.7.0
* (c) 2018 Miljan Aleksic
* @license MIT
*/
import { isUndefined } from 'vuikit/core/util'
/**
* Get or Set an element style property
*/
export default function (el, style, val) {
if (isUndefined(val)) {
return _getStyle(el, style)
} else {
el.style[style] = val
}
}
function _getStyle (el, style) {
if (!el || !style) {
return
}
return window.getComputedStyle
? window.getComputedStyle(el, null)[style]
: el.currentStyle[style]
}