fix(nav-bar): prevent getRect (#3822)

fix #3818
This commit is contained in:
rex 2020-12-08 15:25:15 +08:00 committed by GitHub
parent ed834afc44
commit e0335973c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 12 deletions

View File

@ -65,7 +65,9 @@ VantComponent({
wx.nextTick(() => {
getRect.call(this, '.van-nav-bar').then((res) => {
if (res && 'height' in res) {
this.setData({ height: res.height });
}
});
});
},

View File

@ -1,15 +1,11 @@
/* eslint-disable */
function barStyle(data) {
var styles = [
['z-index', data.zIndex],
['padding-top', data.safeAreaInsetTop ? data.statusBarHeight + 'px' : 0],
];
var style = require('../wxs/style.wxs');
return styles
.map(function (item) {
return item.join(':');
})
.join(';');
function barStyle(data) {
return style({
'z-index': data.zIndex,
'padding-top': data.safeAreaInsetTop ? data.statusBarHeight + 'px' : 0,
});
}
module.exports = {

View File

@ -4,7 +4,7 @@ var object = require('./object.wxs');
function style(styles) {
return object.keys(styles)
.filter(function (key) {
return styles[key];
return styles[key] != null;
})
.map(function (key) {
return [key, [styles[key]]].join(':');