| | |
| | | class="u-navbar__placeholder" |
| | | v-if="fixed && placeholder" |
| | | :style="{ |
| | | height: addUnit(getPx(height) + sys().statusBarHeight,'px'), |
| | | height: addUnit(getPx(height) + getWindowInfo().statusBarHeight,'px'), |
| | | }" |
| | | ></view> |
| | | <view :class="[fixed && 'u-navbar--fixed']"> |
| | |
| | | class="u-line-1 u-navbar__content__title" |
| | | :style="[{ |
| | | width: addUnit(titleWidth), |
| | | color: titleColor, |
| | | }, addStyle(titleStyle)]" |
| | | >{{ title }}</text> |
| | | </slot> |
| | |
| | | import { props } from './props'; |
| | | import { mpMixin } from '../../libs/mixin/mpMixin'; |
| | | import { mixin } from '../../libs/mixin/mixin'; |
| | | import { addUnit, addStyle, getPx, sys } from '../../libs/function/index'; |
| | | import config from '../../libs/config/config'; |
| | | import { addUnit, addStyle, getPx, getWindowInfo } from '../../libs/function/index'; |
| | | /** |
| | | * Navbar 自定义导航栏 |
| | | * @description 此组件一般用于在特殊情况下,需要自定义导航栏的时候用到,一般建议使用uni-app带的导航栏。 |
| | |
| | | * @property {Boolean} placeholder 固定在顶部时,是否生成一个等高元素,以防止塌陷 (默认 false ) |
| | | * @property {Boolean} fixed 导航栏是否固定在顶部 (默认 false ) |
| | | * @property {Boolean} border 导航栏底部是否显示下边框 (默认 false ) |
| | | * @property {String} leftIcon 左边返回图标的名称,只能为uView自带的图标 (默认 'arrow-left' ) |
| | | * @property {String} leftIcon 左边返回图标的名称,只能为uview-pls自带的图标 (默认 'arrow-left' ) |
| | | * @property {String} leftText 左边的提示文字 |
| | | * @property {String} rightText 右边的提示文字 |
| | | * @property {String} rightIcon 右边返回图标的名称,只能为uView自带的图标 |
| | | * @property {String} rightIcon 右边返回图标的名称,只能为uview-plus自带的图标 |
| | | * @property {String} title 导航栏标题,如设置为空字符,将会隐藏标题占位区域 |
| | | * @property {String} titleColor 文字颜色 (默认 '' ) |
| | | * @property {String} bgColor 导航栏背景设置 (默认 '#ffffff' ) |
| | | * @property {String | Number} titleWidth 导航栏标题的最大宽度,内容超出会以省略号隐藏 (默认 '400rpx' ) |
| | | * @property {String | Number} height 导航栏高度(不包括状态栏高度在内,内部自动加上)(默认 '44px' ) |
| | |
| | | methods: { |
| | | addStyle, |
| | | addUnit, |
| | | sys, |
| | | getWindowInfo, |
| | | getPx, |
| | | // 点击左侧区域 |
| | | leftClick() { |
| | | // 如果配置了autoBack,自动返回上一页 |
| | | this.$emit('leftClick') |
| | | if(this.autoBack) { |
| | | uni.navigateBack() |
| | | if (config.interceptor.navbarLeftClick != null) { |
| | | config.interceptor.navbarLeftClick() |
| | | } else { |
| | | if(this.autoBack) { |
| | | uni.navigateBack() |
| | | } |
| | | } |
| | | }, |
| | | // 点击右侧区域 |