Allgemeine Idee: Schritt 1: „navigationStyle“: „custom“
Schritt 2: Hervorhebung in der Vorlage: ref="top" zur Ansicht hinzufügen
Schritt 3: Verlaufsstil hinzufügen
1、pages.json
{
"path" : "pages/user/user",
"style" :
{
"navigationBarTitleText": "我的",
"navigationBarTextStyle":"black",//标题栏字体颜色
"navigationBarBackgroundColor": "#1890FF",//标题栏背景色(纯色)
"navigationStyle":"custom"//用户自定义(添加此处!!!!!)
}
}
Die erste Methode: Fügen Sie dem Stil eine Verlaufsfarbe hinzu
<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,
}
Effektbild:
Die zweite Methode: Verwenden Sie das Hintergrundbild
<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;
}
Renderings: