From 6ed16c0770bae76f88b2df0571cea272aaac8b1c Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 15 Jan 2022 20:01:55 +0800 Subject: [PATCH] fix(NavBar): get correct height in mobile safari (#10190) --- src/nav-bar/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/nav-bar/index.js b/src/nav-bar/index.js index 3e43cf120..1a64c783f 100644 --- a/src/nav-bar/index.js +++ b/src/nav-bar/index.js @@ -31,7 +31,13 @@ export default createComponent({ mounted() { if (this.placeholder && this.fixed) { - this.height = this.$refs.navBar.getBoundingClientRect().height; + const setHeight = () => { + this.height = this.$refs.navBar.getBoundingClientRect().height; + }; + + setHeight(); + // https://github.com/youzan/vant/issues/10131 + setTimeout(setHeight, 100); } },