需求动态修改buttons的样式
setTitle(){
let pages = getCurrentPages()
let page = pages[pages.length-1]
let wv = page.$getAppWebview()
wv.setTitleNViewButtonStyle(0,{
width:'200px',
// 其它设置的属性
})
}
需求 让uniapp title加粗
解决方案
1,自定义 navBar 下拉刷新时 loading会在 navBar上方
2,使用 buttons作为标题
需要动态设置 中间作为标题的buttons的宽度
setTitleNViewButtonWidth(i, w) {
// #ifdef APP-PLUS
let windowsWidth
uni.getSystemInfo({
success: function(res) {
windowsWidth = res.windowWidth
}
})
console.log("==============",windowsWidth,i,w)
let pages = getCurrentPages();
let page = pages[pages.length - 1];
let wv = page.$getAppWebview();
wv.setTitleNViewButtonStyle(i, {
width: (windowsWidth - w) + 'px'
})
// #endif
}