uniapp自定义状态栏配置
2020-04-27 本文已影响0人
在下高姓
####page.json:
{
"path": "pages/index/index",
"style": {
// #ifdef MP
"navigationBarTitleText": "Dloud商城",
// "navigationStyle": "custom",
// #endif
"app-plus": {
"titleNView": {
"type": "transparent",
"searchInput": {
"backgroundColor": "rgba(231, 231, 231,.7)",
"borderRadius": "16px",
"placeholder": "请输入地址 如:北京",
"disabled": true,
"placeholderColor": "#606266"
},
"buttons": [{
"fontSrc": "/static/yticon.ttf",
"text": "\ue60d",
"fontSize": "26",
"color": "#303133",
"float": "left",
"background": "rgba(0,0,0,0)"
},
{
"fontSrc": "/static/yticon.ttf",
"text": "\ue744",
"fontSize": "27",
"color": "#303133",
"background": "rgba(0,0,0,0)",
"redDot": true
}
]
}
}
}
},
页面调用:index
// 标题栏input搜索框点击
onNavigationBarSearchInputClicked: async function(e) {
this.$api.msg('点击了搜索框');
},
//点击导航栏 buttons 时触发
onNavigationBarButtonTap(e) {//通过下标访问自定义的按钮
const index = e.index;
if (index === 0) {
this.$api.msg('点击了扫描');
} else if (index === 1) {
this.$api.msg('222');
// #ifdef APP-PLUS
const pages = getCurrentPages();
const page = pages[pages.length - 1];
const currentWebview = page.$getAppWebview();
currentWebview.hideTitleNViewButtonRedDot({
index
});
// #endif
uni.navigateTo({
url: '/pages/notice/notice'
})
}
}
// #endif