Files
2023-08-18 17:32:18 +08:00

25 lines
672 B
XML

var isEmptyObj = function (obj) {
return JSON.stringify(obj) === '{}';
};
var changeNumToStr = function (arr) {
return arr.map(function (item) {
return typeof item === 'number' ? item + 'rpx' : item;
});
};
var getMessageStyles = function (zIndex, offset, wrapTop) {
var arr = changeNumToStr(offset);
var styleOffset = '';
styleOffset += 'top:' + changeNumToStr([wrapTop * 2]) + ';';
styleOffset += 'right:' + arr[1] + ';';
styleOffset += 'left:' + arr[1] + ';';
var zIndexStyle = zIndex ? 'z-index:' + zIndex + ';' : '';
return zIndexStyle + styleOffset;
};
module.exports = {
getMessageStyles: getMessageStyles,
isEmptyObj: isEmptyObj,
};