Skip to content

Commit 4133b4e

Browse files
committed
fix: getAppBar may return null in webview renderer
1 parent f26e24c commit 4133b4e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

miniprogram/page/component/index.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ Page({
33
// 仅在 app-bar demo 页面展示
44
if (typeof this.getAppBar === 'function' ) {
55
const appBarComp = this.getAppBar()
6-
appBarComp.setData({
7-
showAppbar: false
8-
})
6+
// component.getAppBar 在 Skyline 中返回 appBar 组件示例,在 webview 中返回 null
7+
if (appBarComp !== null) {
8+
appBarComp.setData({
9+
showAppbar: false
10+
})
11+
}
912
}
1013

1114
wx.reportAnalytics('enter_home_programmatically', {})

0 commit comments

Comments
 (0)