Commit fa54e2c1 authored by Xuguangxing's avatar Xuguangxing

feat: 升级组件库

parent 378dad86
......@@ -90,13 +90,13 @@ export const convertPointStyle = (point, defaultStyle, directionKey = DK) => {
};
export const isPx = str => /(\d+(\.\d*)?)+(px)/gi.test(str);
export const pxToRem = (str, width = 37.5) => {
const reg = /(\d+(\.\d*)?)+(px)/gi; //可以匹配浮点数
let newStr = str.replace(reg, function (_x) {
const reg = /(\d+(\.\d*)?)+(px)/gi; // 可以匹配浮点数
const newStr = str.replace(reg, function(_x) {
_x = _x.replace(/px"/gi, '');
return parseFloat(parseFloat(_x) / width).toFixed(2) + 'rem';
});
return newStr;
}
};
export const getStyle = function(oElement, sName) {
const result = oElement.currentStyle ? oElement.currentStyle[sName] : getComputedStyle(oElement, null)[sName];
return result.includes('px') ? result.slice(0, -2) : result;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment