优化组件/更新
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
## 1.3.17(2025-09-03)
|
||||
- 修复 内部样式问题
|
||||
## 1.3.16(2025-08-18)
|
||||
- 修复 微信小程序 fixed 下避让胶囊,优化标题居中,默认showMenuButtonWidth 不开启下,右侧插槽会被 胶囊覆盖
|
||||
- 新增 showMenuButtonWidth 右侧是否避让胶囊,即 显示区域为胶囊左侧,默认不开启,开启后会导致标题不在页面水平居中
|
||||
## 1.3.15(2025-06-24)
|
||||
- 适配微信小程序固定导航栏时,右侧插槽避让胶囊按钮
|
||||
## 1.3.14(2024-10-15)
|
||||
- 修复 微信小程序中的getSystemInfo警告
|
||||
## 1.3.11(2023-03-29)
|
||||
- 修复 自定义状态栏高度闪动BUG
|
||||
## 1.3.10(2023-03-29)
|
||||
- 修复 暗黑模式下边线颜色错误的bug
|
||||
## 1.3.9(2022-10-13)
|
||||
- 修复 条件编译错误的bug
|
||||
## 1.3.8(2022-10-12)
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
<template>
|
||||
<view class="uni-navbar" :class="{'uni-dark':dark, 'uni-nvue-fixed': fixed}">
|
||||
<view class="uni-navbar__content" :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }"
|
||||
:style="{ 'background': themeBgColor }" >
|
||||
<view class="uni-navbar__content" :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }" :style="{ 'background-color': themeBgColor }">
|
||||
<status-bar v-if="statusBar" />
|
||||
<view :style="{ color: themeColor,background: themeBgColor ,height:navbarHeight}"
|
||||
class="uni-navbar__header">
|
||||
<view @tap="onClickLeft" class="uni-navbar__header-btns uni-navbar__header-btns-left"
|
||||
:style="{width:leftIconWidth}">
|
||||
<view :style="{ color: themeColor,backgroundColor: themeBgColor ,height:navbarHeight,width:showMenuButtonWidth?navWidth+'px':'100%'}" class="uni-navbar__header">
|
||||
<view @tap="onClickLeft" class="uni-navbar__header-btns uni-navbar__header-btns-left" :style="{width:leftIconWidth}">
|
||||
<slot name="left">
|
||||
<view class="uni-navbar__content_view" v-if="leftIcon.length > 0">
|
||||
<uni-icons :color="themeColor" :type="leftIcon" size="20" />
|
||||
</view>
|
||||
<view :class="{ 'uni-navbar-btn-icon-left': !leftIcon.length > 0 }" class="uni-navbar-btn-text"
|
||||
v-if="leftText.length">
|
||||
<view :class="{ 'uni-navbar-btn-icon-left': !leftIcon.length > 0 }" class="uni-navbar-btn-text" v-if="leftText.length">
|
||||
<text :style="{ color: themeColor, fontSize: '12px' }">{{ leftText }}</text>
|
||||
</view>
|
||||
</slot>
|
||||
@@ -20,13 +16,11 @@
|
||||
<view class="uni-navbar__header-container " @tap="onClickTitle">
|
||||
<slot>
|
||||
<view class="uni-navbar__header-container-inner" v-if="title.length>0">
|
||||
<text class="uni-nav-bar-text uni-ellipsis-1"
|
||||
:style="{color: themeColor }">{{ title }}</text>
|
||||
<text class="uni-nav-bar-text uni-ellipsis-1" :style="{color: themeColor }">{{ title }}</text>
|
||||
</view>
|
||||
</slot>
|
||||
</view>
|
||||
<view @click="onClickRight" class="uni-navbar__header-btns uni-navbar__header-btns-right"
|
||||
:style="{width:rightIconWidth}">
|
||||
<view @click="onClickRight" class="uni-navbar__header-btns uni-navbar__header-btns-right" :style="{width:rightIconWidth}">
|
||||
<slot name="right">
|
||||
<view v-if="rightIcon.length">
|
||||
<uni-icons :color="themeColor" :type="rightIcon" size="22" />
|
||||
@@ -38,12 +32,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #ifndef APP-NVUE -->
|
||||
<view class="uni-navbar__placeholder" v-if="fixed">
|
||||
<status-bar v-if="statusBar" />
|
||||
<view class="uni-navbar__placeholder-view" :style="{ height:navbarHeight}" />
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -52,8 +44,8 @@
|
||||
const getVal = (val) => typeof val === 'number' ? val + 'px' : val;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NavBar 自定义导航栏
|
||||
* @description 导航栏组件,主要用于头部导航
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=52
|
||||
@@ -140,11 +132,20 @@
|
||||
type: [Number, String],
|
||||
default: 60
|
||||
},
|
||||
showMenuButtonWidth: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
stat: {
|
||||
type: [Boolean, String],
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
navWidth: 'auto'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
themeBgColor() {
|
||||
if (this.dark) {
|
||||
@@ -169,6 +170,21 @@
|
||||
return this.color || '#333'
|
||||
},
|
||||
navbarHeight() {
|
||||
// #ifdef MP-WEIXIN
|
||||
if (this.fixed && this.height === 0) {
|
||||
const menuBtnInfo = uni.getMenuButtonBoundingClientRect()
|
||||
const winInfo = uni.getWindowInfo()
|
||||
const statusHeight = winInfo.statusBarHeight
|
||||
const spaceHeight = menuBtnInfo.top - statusHeight
|
||||
return getVal(menuBtnInfo.height + spaceHeight * 2)
|
||||
}
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
if (this.fixed && this.height === 0) {
|
||||
return getVal(44)
|
||||
}
|
||||
// #endif
|
||||
|
||||
return getVal(this.height)
|
||||
},
|
||||
leftIconWidth() {
|
||||
@@ -178,6 +194,15 @@
|
||||
return getVal(this.rightWidth)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// #ifdef MP-WEIXIN
|
||||
if (this.fixed) {
|
||||
const menuBtnInfo = uni.getMenuButtonBoundingClientRect()
|
||||
this.navWidth = menuBtnInfo.left
|
||||
}
|
||||
// #endif
|
||||
|
||||
},
|
||||
mounted() {
|
||||
if (uni.report && this.stat && this.title !== '') {
|
||||
uni.report('title', this.title)
|
||||
@@ -205,6 +230,7 @@
|
||||
position: sticky;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.uni-navbar {
|
||||
// box-sizing: border-box;
|
||||
}
|
||||
@@ -244,13 +270,14 @@
|
||||
}
|
||||
|
||||
.uni-navbar__header {
|
||||
padding: 0 10px;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
padding: 0 10px;
|
||||
flex-direction: row;
|
||||
height: $nav-height;
|
||||
font-size: 12px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.uni-navbar__header-btns {
|
||||
@@ -311,7 +338,6 @@
|
||||
// box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
||||
.uni-navbar__placeholder-view {
|
||||
height: $nav-height;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,14 @@
|
||||
name: 'UniStatusBar',
|
||||
data() {
|
||||
return {
|
||||
statusBarHeight: 20
|
||||
// #ifdef MP-WEIXIN
|
||||
statusBarHeight: uni.getWindowInfo().statusBarHeight + 'px',
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 'px',
|
||||
// #endif
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "uni-nav-bar",
|
||||
"displayName": "uni-nav-bar 自定义导航栏",
|
||||
"version": "1.3.9",
|
||||
"version": "1.3.17",
|
||||
"description": "自定义导航栏组件,主要用于头部导航。",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
@@ -11,12 +11,14 @@
|
||||
],
|
||||
"repository": "https://github.com/dcloudio/uni-ui",
|
||||
"engines": {
|
||||
"HBuilderX": ""
|
||||
"HBuilderX": "",
|
||||
"uni-app": "^4.07",
|
||||
"uni-app-x": ""
|
||||
},
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
@@ -34,51 +36,69 @@
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
"type": "component-vue",
|
||||
"darkmode": "x",
|
||||
"i18n": "x",
|
||||
"widescreen": "x"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [
|
||||
"uni-scss",
|
||||
"uni-icons"
|
||||
],
|
||||
"uni-scss",
|
||||
"uni-icons"
|
||||
],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
"tcb": "x",
|
||||
"aliyun": "x",
|
||||
"alipay": "x"
|
||||
},
|
||||
"client": {
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"app-nvue": "y"
|
||||
"uni-app": {
|
||||
"vue": {
|
||||
"vue2": "√",
|
||||
"vue3": "√"
|
||||
},
|
||||
"web": {
|
||||
"safari": "√",
|
||||
"chrome": "√"
|
||||
},
|
||||
"app": {
|
||||
"vue": "√",
|
||||
"nvue": "√",
|
||||
"android": "√",
|
||||
"ios": "√",
|
||||
"harmony": "√"
|
||||
},
|
||||
"mp": {
|
||||
"weixin": "√",
|
||||
"alipay": "√",
|
||||
"toutiao": "√",
|
||||
"baidu": "√",
|
||||
"kuaishou": "-",
|
||||
"jd": "-",
|
||||
"harmony": "-",
|
||||
"qq": "√",
|
||||
"lark": "-"
|
||||
},
|
||||
"quickapp": {
|
||||
"huawei": "√",
|
||||
"union": "√"
|
||||
}
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "y",
|
||||
"Android Browser": "y",
|
||||
"微信浏览器(Android)": "y",
|
||||
"QQ浏览器(Android)": "y"
|
||||
},
|
||||
"H5-pc": {
|
||||
"Chrome": "y",
|
||||
"IE": "y",
|
||||
"Edge": "y",
|
||||
"Firefox": "y",
|
||||
"Safari": "y"
|
||||
},
|
||||
"小程序": {
|
||||
"微信": "y",
|
||||
"阿里": "y",
|
||||
"百度": "y",
|
||||
"字节跳动": "y",
|
||||
"QQ": "y"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
},
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "y"
|
||||
"uni-app-x": {
|
||||
"web": {
|
||||
"safari": "-",
|
||||
"chrome": "-"
|
||||
},
|
||||
"app": {
|
||||
"android": "-",
|
||||
"ios": "-",
|
||||
"harmony": "-"
|
||||
},
|
||||
"mp": {
|
||||
"weixin": "-"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user