app部分来自于 https://github.com/dcloudio/hello-uniapp
export function setTitleNViewStyle(index, show,text) {
let pages = getCurrentPages();
let page = pages[pages.length - 1];
// #ifdef APP-PLUS
let currentWebview = page.$getAppWebview();
if(show){
if(index === 0){
currentWebview.showTitleNViewButtonRedDot({index:index,text:text})
}else{
currentWebview.setTitleNViewButtonBadge({index:index,text:text})
}
}else{
if(index === 0){
currentWebview.hideTitleNViewButtonRedDot({index:index})
}else{
currentWebview.removeTitleNViewButtonBadge({index:index})
}
}
// #endif
// #ifdef H5
if(show){
if(index === 0){
document.querySelectorAll('.uni-page-head-hd .uni-page-head-btn')[1].classList.add('uni-page-head-btn-red-dot');
} else {
document.querySelector('.uni-page-head-ft .uni-page-head-btn').classList.add('uni-page-head-btn-red-dot');
}
} else {
if(index === 0){
document.querySelector('.uni-page-head-btn-red-dot').classList.remove('uni-page-head-btn-red-dot');
} else {
document.querySelector('.uni-page-head-ft .uni-page-head-btn-red-dot').classList.remove('uni-page-head-btn-red-dot');
}
}
// #endif
}
4 个评论
要回复文章请先登录或注册
蹦豆儿
风云杭州
Basil
5675557