zoujiandong 2bd2fd31ac 1.22
2024-01-22 08:55:30 +08:00

25 lines
699 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, customStyle) {
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 + customStyle;
};
module.exports = {
getMessageStyles: getMessageStyles,
isEmptyObj: isEmptyObj,
};