tencent.jquery.pix.component 1.0.87 → 1.0.88-beta1
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/change.md +6 -0
- package/components/list/list.js +2 -3
- package/package.json +1 -1
- package/utils/utils.js +9 -0
package/change.md
CHANGED
package/components/list/list.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getEnv } from "../config";
|
|
2
|
+
import { remToPx } from "../utils/utils";
|
|
2
3
|
|
|
3
4
|
let $ = null;
|
|
4
5
|
|
|
@@ -39,9 +40,7 @@ List.prototype.init = function () {
|
|
|
39
40
|
if (options.itemHeight.constructor === String) {
|
|
40
41
|
// 如果是rem单位,则需要计算
|
|
41
42
|
if (options.itemHeight.indexOf('rem') > -1) {
|
|
42
|
-
|
|
43
|
-
let num = parseFloat(options.itemHeight.replace('rem', ''));
|
|
44
|
-
options.itemHeight = fonSize * num;
|
|
43
|
+
options.itemHeight = remToPx(options.itemHeight); // fontSize * num;
|
|
45
44
|
} else {
|
|
46
45
|
options.itemHeight = parseFloat(options.itemHeight);
|
|
47
46
|
}
|
package/package.json
CHANGED
package/utils/utils.js
CHANGED
|
@@ -4,9 +4,18 @@ let fontSize = -1;
|
|
|
4
4
|
|
|
5
5
|
// 获取字体大小
|
|
6
6
|
export const getFontSize = () => {
|
|
7
|
+
let htmlFontSize = parseFloat(document.documentElement.style.fontSize.replace('px', ''));
|
|
8
|
+
if (htmlFontSize) {
|
|
9
|
+
return htmlFontSize;
|
|
10
|
+
}
|
|
11
|
+
const baseFontSize = 16; // 默认根元素字体大小
|
|
7
12
|
if (fontSize === -1) {
|
|
8
13
|
fontSize = parseFloat($(document.body).css("font-size").replace('px', ''));
|
|
9
14
|
}
|
|
15
|
+
|
|
16
|
+
if(!fontSize) {
|
|
17
|
+
fontSize = baseFontSize; // 默认字体大小
|
|
18
|
+
}
|
|
10
19
|
return fontSize;
|
|
11
20
|
}
|
|
12
21
|
|