onPageScroll() {
let view = uni.createSelectorQuery().in(this).select(".tabs");
view.boundingClientRect(data => {
console.log("节点离页面顶部的距离为" + data.top);
if(data.top==0){
uni.setNavigationBarColor({
frontColor: "#000000", //文字颜色
backgroundColor: "#ffffff" //底部背景色
})
return
}
if(data.top>0){
uni.setNavigationBarColor({
frontColor: "#ffffff", //文字颜色
backgroundColor: "#314E9B" //底部背景色
})
return
}
}).exec();
},
uni——动态改变导航栏颜色
猜你喜欢
转载自blog.csdn.net/xulihua_75/article/details/128303418
今日推荐
周排行