-
zhangwei
2025-03-05 16213c0f85aa3ac8317797bf4a05fd12940e16d3
src/uni_modules/uview-plus/components/u-navbar/u-navbar.vue
@@ -4,7 +4,7 @@
         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']">
@@ -47,6 +47,7 @@
                  class="u-line-1 u-navbar__content__title"
                  :style="[{
                     width: addUnit(titleWidth),
                     color: titleColor,
                  }, addStyle(titleStyle)]"
               >{{ title }}</text>
            </slot>
@@ -76,7 +77,8 @@
   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带的导航栏。
@@ -85,11 +87,12 @@
    * @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' )
@@ -112,14 +115,18 @@
      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()
               }
            }
         },
         // 点击右侧区域