第一步:在pages.json中
{
"pages":[
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "工作台",
"navigationBarBackgroundColor": "#ecfffc", // 背景
"navigationStyle": "custom"
// 当设置 "navigationStyle":"custom" 取消原生导航栏后,由于窗体为沉浸式,占据了状态栏位置
}
}
]
}
第二步:找到你所需要设置的页面,设置渐变即可
<template>
<view class="top" ref="top"></view>
</template>
<script setup>
</script>
<style scoped lang="scss">
.top {
width: 100%;
height: 88rpx;
background: linear-gradient(
90deg,
rgb(207, 241, 223) 0%,
rgb(242, 251, 236) 100%
);
}
</style>