提交 54cb9604 编写于 作者: fxy060608's avatar fxy060608

fix(h5): addStylesClient

上级 59a8ecca
......@@ -241,7 +241,7 @@ var VAR_WINDOW_RIGHT = /var\(--window-right\)/gi
function processCss(css) {
var page = getPage()
if (!uni.canIUse('css.var')) { //不支持 css 变量
if (typeof uni !== 'undefined' && !uni.canIUse('css.var')) { //不支持 css 变量
var offset = getWindowOffset()
css = css.replace(VAR_STATUS_BAR_HEIGHT, '0px')
.replace(VAR_WINDOW_TOP, offset.top + 'px')
......@@ -253,7 +253,10 @@ function processCss(css) {
.replace(BODY_SCOPED_RE, page)
.replace(BODY_RE, '')
.replace(PAGE_SCOPED_RE, 'body.' + page + ' uni-page-body')
.replace(/\{[\s\S]+?\}/g, function (css) {
.replace(/\{[\s\S]+?\}/g, function (css) {
if(typeof uni === 'undefined'){
return css
}
return css.replace(UPX_RE, function (a, b) {
return uni.upx2px(b) + 'px'
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册