@fonixtree/magic-design 0.1.73 → 0.1.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/utils/commonUtil.js
CHANGED
|
@@ -12,7 +12,7 @@ exports.convertImageUrl = convertImageUrl;
|
|
|
12
12
|
exports.convertToRem = void 0;
|
|
13
13
|
exports.copy2ClipBoard = copy2ClipBoard;
|
|
14
14
|
exports.covertKey = covertKey;
|
|
15
|
-
exports.dragSource = void 0;
|
|
15
|
+
exports.dragSource = exports.downloadBase64Image = void 0;
|
|
16
16
|
exports.ensure = ensure;
|
|
17
17
|
exports.getGAData = exports.getColorRgba = void 0;
|
|
18
18
|
exports.getPageDataMap = getPageDataMap;
|
|
@@ -748,8 +748,11 @@ var convertToRem = function convertToRem(value) {
|
|
|
748
748
|
return value + "px";
|
|
749
749
|
}
|
|
750
750
|
|
|
751
|
+
var baseFont = ensure(function () {
|
|
752
|
+
return window.getComputedStyle(document.getElementsByTagName('html')[0]).fontSize.replace('px');
|
|
753
|
+
}, 50);
|
|
751
754
|
var pxValue = parseFloat(value);
|
|
752
|
-
var remValue = pxValue /
|
|
755
|
+
var remValue = pxValue / baseFont; // 假设1rem = 50px
|
|
753
756
|
|
|
754
757
|
return remValue + "rem";
|
|
755
758
|
};
|
|
@@ -856,4 +859,15 @@ var getGAData = function getGAData(data) {
|
|
|
856
859
|
};
|
|
857
860
|
};
|
|
858
861
|
|
|
859
|
-
exports.getGAData = getGAData;
|
|
862
|
+
exports.getGAData = getGAData;
|
|
863
|
+
|
|
864
|
+
var downloadBase64Image = function downloadBase64Image(base64String, filename) {
|
|
865
|
+
// 创建一个虚拟的链接元素
|
|
866
|
+
var link = document.createElement('a');
|
|
867
|
+
link.href = base64String;
|
|
868
|
+
link.download = filename; // 模拟点击下载
|
|
869
|
+
|
|
870
|
+
link.click();
|
|
871
|
+
};
|
|
872
|
+
|
|
873
|
+
exports.downloadBase64Image = downloadBase64Image;
|
package/lib/utils/commonUtil.js
CHANGED
|
@@ -12,7 +12,7 @@ exports.convertImageUrl = convertImageUrl;
|
|
|
12
12
|
exports.convertToRem = void 0;
|
|
13
13
|
exports.copy2ClipBoard = copy2ClipBoard;
|
|
14
14
|
exports.covertKey = covertKey;
|
|
15
|
-
exports.dragSource = void 0;
|
|
15
|
+
exports.dragSource = exports.downloadBase64Image = void 0;
|
|
16
16
|
exports.ensure = ensure;
|
|
17
17
|
exports.getGAData = exports.getColorRgba = void 0;
|
|
18
18
|
exports.getPageDataMap = getPageDataMap;
|
|
@@ -748,8 +748,11 @@ var convertToRem = function convertToRem(value) {
|
|
|
748
748
|
return value + "px";
|
|
749
749
|
}
|
|
750
750
|
|
|
751
|
+
var baseFont = ensure(function () {
|
|
752
|
+
return window.getComputedStyle(document.getElementsByTagName('html')[0]).fontSize.replace('px');
|
|
753
|
+
}, 50);
|
|
751
754
|
var pxValue = parseFloat(value);
|
|
752
|
-
var remValue = pxValue /
|
|
755
|
+
var remValue = pxValue / baseFont; // 假设1rem = 50px
|
|
753
756
|
|
|
754
757
|
return remValue + "rem";
|
|
755
758
|
};
|
|
@@ -856,4 +859,15 @@ var getGAData = function getGAData(data) {
|
|
|
856
859
|
};
|
|
857
860
|
};
|
|
858
861
|
|
|
859
|
-
exports.getGAData = getGAData;
|
|
862
|
+
exports.getGAData = getGAData;
|
|
863
|
+
|
|
864
|
+
var downloadBase64Image = function downloadBase64Image(base64String, filename) {
|
|
865
|
+
// 创建一个虚拟的链接元素
|
|
866
|
+
var link = document.createElement('a');
|
|
867
|
+
link.href = base64String;
|
|
868
|
+
link.download = filename; // 模拟点击下载
|
|
869
|
+
|
|
870
|
+
link.click();
|
|
871
|
+
};
|
|
872
|
+
|
|
873
|
+
exports.downloadBase64Image = downloadBase64Image;
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|