clip-path: polygon(
0 0,
68% 0,
100% 32%,
100% 100%,
0 100%
);//这里切割出来是少一角的正方形
letter-spacing: 1vw; //文字间隔
-webkit-text-stroke: 1px #fff; //文字描边1px
uniapp微信小程序顶部导航栏设置透明,下拉改变透明度
onPageScroll(e) {
if (!this.isUser) {
return
}
this.scrollY = e.scrollTop;
if (e.scrollTop > 40) {
uni.setNavigationBarColor({
frontColor: '#000000',
backgroundColor: '#000000',
})
this.topTitleColor = '#000000'
} else {
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: '#ffffff',
})
this.topTitleColor = '#ffffff'
}
let opacity = 0
if (e.scrollTop <= 100) {
opacity = this.scrollY / 100;
} else {
opacity = 1
}
this.navBarColor = `rgba(255, 255, 255, ${opacity})`;
},
<view v-if="isUser" class="nav-bar" :style="{backgroundColor: navBarColor,color:topTitleColor}">
<!-- 导航栏内容 -->
首页
</view>
scrollY: 0, // 当前滚动距离
navBarColor: 'rgba(255, 255, 255, 0)', // 导航栏背景颜色,初始为透明色
topTitleColor: 'white',