mirror of
https://github.com/youzan/vant.git
synced 2026-06-12 01:14:32 +08:00
chore: add getZIndexStyle util (#8254)
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user