uniapp中默认导航栏中添加按钮或者文字以及触发
"pages": [{"path": "pages/index/index","style": {"app-plus": {"titleNView": {"buttons": [{ //右侧操作按钮样式定义,是以数组形式定义,可定义多个"color": "#ffffff","fontSize": "50rpx","float":"left",//导航栏的左右位置"type":"back"//.
·
"pages": [{
"path": "pages/index/index",
"style": {
"app-plus": {
"titleNView": {
"buttons": [{ //右侧操作按钮样式定义,是以数组形式定义,可定义多个
"color": "#ffffff",
"fontSize": "50rpx",
"float":"left",//导航栏的左右位置
"type":"back"//按钮类型
}]
}
}
}
},
导航栏的按钮事件触发:
onNavigationBarButtonTap(e) {
console.log("success")
uni.showModal({
title: '提示',
content: '是否退出?',
success: function(res) {
//按钮事件触发逻辑
uni.navigateTo({
url: '../comprehensive/comprehensive?e=0'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
return true;
},
官网详细地址:uni-app官网
更多推荐


所有评论(0)