提交 b8f203d9 编写于 作者: DCloud-yinjiacheng's avatar DCloud-yinjiacheng 提交者: DCloud-WZF

更新scroll-fold-nav示例

上级 aa47815a
...@@ -44,7 +44,8 @@ ...@@ -44,7 +44,8 @@
nviBarHeight: 0, nviBarHeight: 0,
naviElement: null as UniElement | null, naviElement: null as UniElement | null,
titleElement: null as UniElement | null, titleElement: null as UniElement | null,
searchElement: null as UniElement | null searchElement: null as UniElement | null,
seatElement: null as UniElement | null
} }
}, },
onLoad() { onLoad() {
...@@ -57,11 +58,16 @@ ...@@ -57,11 +58,16 @@
this.naviElement = this.$refs['navigatorbar'] as UniElement; this.naviElement = this.$refs['navigatorbar'] as UniElement;
this.searchElement = this.$refs['searchbar'] as UniElement; this.searchElement = this.$refs['searchbar'] as UniElement;
this.titleElement = this.$refs['title'] as UniElement; this.titleElement = this.$refs['title'] as UniElement;
//适配不同状态栏高度 this.seatElement = this.$refs['seatbar'] as UniElement;
this.naviElement?.style?.setProperty('padding-top', this.statusBarHeight+'px'); this.setStyle();
this.naviElement?.style?.setProperty('height', (NAVIBARHEIGHT+this.statusBarHeight)+'px'); },
let seatElement = this.$refs['seatbar'] as UniElement; onResize(_ : OnResizeOptions) {
seatElement.style.setProperty('height', (NAVIBARHEIGHT+this.statusBarHeight)+'px'); // #ifdef APP-ANDROID
// 监听多窗口模式
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
this.nviBarHeight = NAVIBARHEIGHT + this.statusBarHeight;
this.setStyle();
// #endif
}, },
methods: { methods: {
onScroll(e : ScrollEvent) { onScroll(e : ScrollEvent) {
...@@ -78,7 +84,12 @@ ...@@ -78,7 +84,12 @@
title: '暂不支持', title: '暂不支持',
icon: 'none' icon: 'none'
}); });
} },
setStyle() {
this.naviElement?.style?.setProperty('padding-top', this.statusBarHeight + 'px');
this.naviElement?.style?.setProperty('height', (NAVIBARHEIGHT + this.statusBarHeight) + 'px');
this.seatElement?.style?.setProperty('height', (NAVIBARHEIGHT + this.statusBarHeight) + 'px');
}
} }
} }
</script> </script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册