1.0.3 • Published 5 years ago

swan-solution-components-navigation-bar v1.0.3

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

解释:自定义导航条

属性说明:

属性名类型必填默认值说明
page-titleString-页面标题
status-bar-heightnum20状态栏的高度,使用时通过swan.getSystemInfoSync().statusBarHeight获取
navigation-bar-heightnum44导航栏的高度,使用时通过swan.getSystemInfoSync().navigationBarHeight获取
color-typeStringdark字体颜色类型,有深色和浅色,分别为dark、light
need-to-returnBooleanfalse返回上一页的按钮
need-to-homeBooleanfalse返回首页的按钮
show-titleBooleantrue是否显示标题
opacity-barBooleanfalse是否设置透明
bindgotohomeFunction-返回首页,当need-to-home为true时需要此函数,用法参见下面示例

示例

json:

    {
        "navigationBarTitleText": "标题",
        "navigationStyle": "custom",
        "usingComponents": {
            "navigation-bar": "/components/navigation-bar/navigation-bar"
        }
    }

swan:

    <view>
        <navigation-bar
            opacity-bar="{{opacityBar}}"
            need-to-return="{{isNeedToReturn}}"
            need-to-Home="{{isNeedToHome}}"
            color-type="{{arrowColor}}"
            show-title="{{showTitle}}"
            status-bar-height="{{statusBarHeight}}"
            navigation-bar-height="{{navigationBarHeight}}"
            page-title="{{detailData.plateInfo.name}}"
            bindgotohome="goToHome">
        </navigation-bar>
    </view>

js:

    Page({
        data: {
            // 状态栏的高度
            statusBarHeight: '',
            // 导航栏的高度
            navigationBarHeight: '',
            opacityBar: true,
            showTitle: true,
            isNeedToHome: true,
            isNeedToReturn: true,
            showOpacity: true
        },
        onLoad(options) {
            let {statusBarHeight, navigationBarHeight} = swan.getSystemInfoSync();
            this.setData({
                statusBarHeight,
                navigationBarHeight
            });
        },
        goToHome() {
            swan.reLaunch({
                url: '/pages/index/index'
            });
        }
    })
1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago