uniapp顶部颜色如何设置成渐变色?


第一步:在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>

文章作者: 冷杨威
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 冷杨威 !
  目录
-->