美文网首页
uniapp自定义状态栏配置

uniapp自定义状态栏配置

作者: 在下高姓 | 来源:发表于2020-04-27 11:39 被阅读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

相关文章

网友评论

      本文标题:uniapp自定义状态栏配置

      本文链接:https://www.haomeiwen.com/subject/oskywhtx.html