如下是uniapp的项目代码,用的是uview框架,效果是下面的样子
问题就是标题栏的颜色不变啊,我全局变量也都调过了
<template>
<view class="content">
<u-navbar :is-back="true" title="专业" :background="background">
</u-navbar>
<view class="content">
<!-- 正文内容 -->
</view>
</view>
</template>
<script>
export default {
data() {
return {
background:{
backgroundColor: "#ee27a2s",
// 导航栏背景图
// background: 'url(https://cdn.uviewui.com/uview/swiper/1.jpg) no-repeat',
// 还可以设置背景图size属性
// backgroundSize: 'cover',
// 渐变色
// backgroundImage: 'linear-gradient(45deg, rgb(28, 187, 180), rgb(141, 198, 63))'
}
}
},
onLoad() {
},
methods:{
}
}
</script>
<style scoped lang="scss">
@import '@/uni_modules/uview-ui/index.scss';
.slot-wrap {
display: flex;
align-items: center;
/* 如果您想让slot内容占满整个导航栏的宽度 */
flex: 1;
/* 如果您想让slot内容与导航栏左右有空隙 */
/* padding: 0 30rpx; */
}
</style>
uview什么版本