UNPKG

acud

Version:

acg react 组件库

34 lines • 1.18 kB
/** converting camel-cased strings to be lowercase and link it with Separato */ export function toLowercaseSeparator(key) { return key.replace(/([A-Z])/g, '-$1').toLowerCase(); } /** * 获取样式字符串 * * @param style - 样式对象,React 的 CSSProperties 类型 * @returns 返回样式字符串 */ export function getStyleStr(style) { return Object.keys(style).map(function (key) { return "".concat(toLowercaseSeparator(key), ": ").concat(style[key], ";"); }).join(' '); } /** Returns the ratio of the device's physical pixel resolution to the css pixel resolution */ export function getPixelRatio() { return window.devicePixelRatio || 1; } /** Whether to re-render the watermark */ export var reRendering = function reRendering(mutation, isWatermarkEle) { var flag = false; // Whether to delete the watermark node if (mutation.removedNodes.length) { flag = Array.from(mutation.removedNodes).some(function (node) { return isWatermarkEle(node); }); } // Whether the watermark dom property value has been modified if (mutation.type === 'attributes' && isWatermarkEle(mutation.target)) { flag = true; } return flag; };