You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
425 B
20 lines
425 B
import {
|
|
transformCSS
|
|
} from '../../upx'
|
|
|
|
export function parseStyleUnit (styles) {
|
|
let newStyles = {}
|
|
const stylesStr = JSON.stringify(styles)
|
|
if (~stylesStr.indexOf('upx') || ~stylesStr.indexOf('rpx')) {
|
|
try {
|
|
newStyles = JSON.parse(transformCSS(stylesStr))
|
|
} catch (e) {
|
|
newStyles = styles
|
|
console.error(e)
|
|
}
|
|
} else {
|
|
newStyles = JSON.parse(stylesStr)
|
|
}
|
|
|
|
return newStyles
|
|
}
|
|
|