uniapp Wechat アプレット ナビゲーションバー背景色タイトル バーの色のグラデーション

一般的なアイデア: ステップ 1: "navigationStyle": "custom"
ステップ 2: テンプレートでの強調: ref="top" をビューに追加する
ステップ 3: グラデーション スタイルを追加する

1、pages.json

{
    
    
  "path" : "pages/user/user",
    "style" :                                                                                    
    {
    
    
        "navigationBarTitleText": "我的",
		"navigationBarTextStyle":"black",//标题栏字体颜色
		"navigationBarBackgroundColor": "#1890FF",//标题栏背景色(纯色)
		"navigationStyle":"custom"//用户自定义(添加此处!!!!!)
    }            
}

最初の方法: スタイルにグラデーション カラーを追加します。

<view class="top" ref="top"></view>
.top{
    
    
   width: 100%;
   height: 200px;
   background: linear-gradient(121deg, #94C7FE -1%, #1890FF 102%);
   box-shadow: 24px 52px 100px 0px rgba(90, 108, 234, 
}

効果画像:
ここに画像の説明を挿入
2 番目の方法: 背景画像を使用する

<view class="top" ref="top">
	<image mode="widthFix" class="top-img" src="@/static/img/bg.png"></image>
</view>
.top-img {
    
    
	display: block;
	width: 100%;
	height: 324rpx;
}

レンダリング:
ここに画像の説明を挿入

おすすめ

転載: blog.csdn.net/maoge_666/article/details/131942286