chore: add getZIndexStyle util (#8254)

This commit is contained in:
neverland
2021-03-03 16:45:32 +08:00
committed by GitHub
parent 202edb24c7
commit 2d8914c2c8
11 changed files with 40 additions and 36 deletions
+12 -1
View File
@@ -1,3 +1,4 @@
import { CSSProperties } from 'vue';
import { isDef, inBrowser } from '../base';
import { isNumeric } from '../validate/number';
@@ -9,7 +10,9 @@ export function addUnit(value?: string | number): string | undefined {
return isNumeric(value) ? `${value}px` : String(value);
}
export function getSizeStyle(originSize?: string | number) {
export function getSizeStyle(
originSize?: string | number
): CSSProperties | undefined {
if (isDef(originSize)) {
const size = addUnit(originSize);
return {
@@ -19,6 +22,14 @@ export function getSizeStyle(originSize?: string | number) {
}
}
export function getZIndexStyle(zIndex?: string | number) {
const style: CSSProperties = {};
if (zIndex !== undefined) {
style.zIndex = +zIndex;
}
return style;
}
// cache
let rootFontSize: number;