uni-app頁面導航欄透明背景


效果:

 

 

代碼:

// pages.json ,需要的頁面添加 
{
"path": "pages/ServiceHome/ServiceHome", "style": { "navigationBarTitleText": "uni-app", "navigationBarBackgroundColor": "transparent", "navigationBarTextStyle": "white", "app-plus": { "titleNView": { "type": "float", "titleText": "uni-app" } } } },
<template>
    <view class="home-container">
        <view class="home-top">
            <image class="bg" src="../../static/icon/bg.jpeg"></image>
        </view>
    </view>
</template>

<script>
</script>

<style lang="scss" scoped>
    .home-container{
        min-height: 100vh;
        .home-top{
            position: relative;
            width: 100vw;
            height: 500rpx;
            background-color: #007AFF;
            .bg{
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
            }
        }
    }
</style>

 2021.2.15更,以上方法iOS機型沒問題,Android不生效

改如下即可

        {
           "path": "pages/PersonCenter/Login",
           "style": {
            "navigationBarBackgroundColor": "transparent",
            "navigationBarTextStyle": "white",
            "app-plus": {
                "titleNView": false
            }
          }
        },

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM