uview-plus 3.8.128 → 3.8.129

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/changelog.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 3.8.129
2
+ fix: 修复条码画布引用时序与微信小程序导航栏胶囊遮挡
3
+
4
+ 本次更新修复条码组件获取画布引用的时序问题,并优化微信小程序导航栏右侧区域布局。
5
+
6
+ - u-barcode:等待组件自身视图更新后再获取画布引用,避免画布引用尚未就绪。
7
+ - u-navbar:微信小程序右侧插槽、图标和文字默认避让原生胶囊按钮,修复遮挡问题(#1058)。
8
+ - u-navbar:新增 avoidCapsule 属性,默认 true,可设置为 false 保持原有右侧布局;同步全局默认配置与类型声明。
9
+
1
10
  ## 3.8.128
2
11
  feat: 新增 u-video 视频播放器组件,并集中修复列表滚动、日历副标题、下拉菜单等 20+ 个问题
3
12
 
@@ -359,7 +359,7 @@ export default {
359
359
  },
360
360
 
361
361
  async getCanvasRef(refName) {
362
- await nextTick()
362
+ await this.$nextTick()
363
363
  const canvas = this.$refs[refName]
364
364
  if (!canvas) {
365
365
  throw new Error(`Canvas ref not found: ${refName}`)
@@ -28,7 +28,8 @@ export default {
28
28
  autoBack: false,
29
29
  titleStyle: '',
30
30
  mode: 'default',
31
- scrollTop: 0
31
+ scrollTop: 0,
32
+ avoidCapsule: true
32
33
  }
33
34
 
34
35
  }
@@ -104,6 +104,11 @@ export const props = defineMixin({
104
104
  scrollTop: {
105
105
  type: [String, Number],
106
106
  default: () => defProps.navbar.scrollTop
107
- }
107
+ },
108
+ // 微信小程序端右侧区域是否避让右上角原生胶囊按钮
109
+ avoidCapsule: {
110
+ type: Boolean,
111
+ default: () => defProps.navbar.avoidCapsule
112
+ },
108
113
  }
109
114
  })
@@ -85,6 +85,7 @@
85
85
  </view>
86
86
  <view
87
87
  class="u-navbar__content__right"
88
+ :style="[navbarRightStyle]"
88
89
  v-if="$slots.right || rightIcon || rightText"
89
90
  @tap="rightClick"
90
91
  >
@@ -143,6 +144,7 @@
143
144
  * @property {Object | String} titleStyle 标题的样式,对象或字符串
144
145
  * @property {String} mode 导航栏模式,default-常规,ios-大标题磨砂模式(默认 'default' )
145
146
  * @property {String | Number} scrollTop 页面滚动距离,仅 ios 模式使用,由页面 onPageScroll 传入(默认 0 )
147
+ * @property {Boolean} avoidCapsule 微信小程序端右侧区域是否避让右上角原生胶囊按钮(默认 true )
146
148
  * @event {Function} leftClick 点击左侧区域
147
149
  * @event {Function} rightClick 点击右侧区域
148
150
  * @example <u-navbar title="剑未配妥,出门已是江湖" left-text="返回" right-text="帮助" @click-left="onClickBack" @click-right="onClickRight"></u-navbar>
@@ -221,9 +223,24 @@
221
223
  if (this.leftIconColor) return this.leftIconColor
222
224
  return this.upThemeVar('--up-main-color', this.$u.color.mainColor)
223
225
  },
224
- navbarRightColor() {
225
- return this.upThemeVar('--up-main-color', this.$u.color.mainColor)
226
- },
226
+ navbarRightColor() {
227
+ return this.upThemeVar('--up-main-color', this.$u.color.mainColor)
228
+ },
229
+ // 微信小程序端右侧区域避让右上角原生胶囊按钮:
230
+ // 将容器右边缘从屏幕右缘移到胶囊左缘,内容随容器自带 padding 自然留出间距。
231
+ navbarRightStyle() {
232
+ // #ifdef MP-WEIXIN
233
+ if (!this.avoidCapsule) return {}
234
+ const rect = uni.getMenuButtonBoundingClientRect()
235
+ const windowWidth = getWindowInfo().windowWidth
236
+ // 胶囊信息不可用(部分调试环境返回全 0)时维持原有布局
237
+ if (!rect || !rect.left || !windowWidth) return {}
238
+ return { right: `${windowWidth - rect.left}px` }
239
+ // #endif
240
+ // #ifndef MP-WEIXIN
241
+ return {}
242
+ // #endif
243
+ },
227
244
  navbarInnerStyle() {
228
245
  const style = {}
229
246
  style.background = this.navbarBgColor
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "uview-plus",
3
3
  "name": "uview-plus",
4
4
  "displayName": "零云®uview-plus3.0重磅发布,全面的Vue3鸿蒙跨端移动组件库,组件丰富维护更新稳定。",
5
- "version": "3.8.128",
5
+ "version": "3.8.129",
6
6
  "description": "零云®uview-plus已兼容vue3支持多语言,120+全面的组件和便捷的工具会让您信手拈来。近期新增拖动排序、条码、图片裁剪、下拉刷新、虚拟列表、签名、Markdown等。",
7
7
  "keywords": [
8
8
  "uview",
@@ -94,6 +94,12 @@ declare interface NavbarProps {
94
94
  * @default 0
95
95
  */
96
96
  scrollTop?: string | number
97
+ /**
98
+ * 微信小程序端右侧区域是否避让右上角原生胶囊按钮,
99
+ * 避让后右边缘与胶囊左缘对齐。其他平台无胶囊,此属性不生效。
100
+ * @default true
101
+ */
102
+ avoidCapsule?: boolean
97
103
  /**
98
104
  * 点击左侧区域
99
105
  */