效果

一 、page.json
"transparentTitle": "always"
二、page.axml
<view class="custom-navigation" style="height:{{systemInfo.statusBarHeight+systemInfo.titleBarHeight+100}}px">
</view>
三、page.less
.custom-navigation {
background: url(/assets/images/navigation-bg.png);
background-size: 100% 100%;
}
四、page.ts
data:{
systemInfo: {},
}
onLoad(){
my.getSystemInfo({
success: (res) => {
this.setData({
systemInfo: res,
})
},
})
}
该文介绍如何在页面配置(page.json)中设置透明标题,并在page.axml中通过获取systemInfo动态设置导航栏高度,同时在page.less中设定背景图片。在page.ts中使用onLoad方法获取系统信息以实现适配。
1774

被折叠的 条评论
为什么被折叠?



