uview-plus 3.5.22 → 3.5.28

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,23 @@
1
+ ## 3.5.28(2025-08-29)
2
+ feat: 多语言增加泰语
3
+
4
+ ## 3.5.27(2025-08-29)
5
+ feat: 新增基于tooltip的popover组件
6
+
7
+ ## 3.5.26(2025-08-29)
8
+ improvment: 增强多语言兼容性
9
+
10
+ ## 3.5.25(2025-08-28)
11
+ fix: 修复左侧与右侧弹出时页面打开闪现问题
12
+
13
+ ## 3.5.24(2025-08-28)
14
+ feat: 优化tooltip弹窗定位
15
+
16
+ feat: tooltip组件新增forcePosition支持强制精确定位
17
+
18
+ ## 3.5.23(2025-08-28)
19
+ improvment: 调整pdf阅读器默认高度
20
+
1
21
  ## 3.5.22(2025-08-28)
2
22
  feat: 新增goods-sku商品SKU选购组件
3
23
 
@@ -8,7 +8,7 @@ export default {
8
8
  // 组件高度
9
9
  height: {
10
10
  type: String,
11
- default: '700px'
11
+ default: '500px'
12
12
  },
13
13
  // pdfjs资源域名
14
14
  baseUrl: {
@@ -0,0 +1,59 @@
1
+ import { defineMixin } from '../../libs/vue'
2
+ import defProps from '../../libs/config/props.js'
3
+
4
+ export const props = defineMixin({
5
+ props: {
6
+ // 显示的文字内容
7
+ text: {
8
+ type: [String, Number],
9
+ default: ''
10
+ },
11
+ // 文字颜色
12
+ color: {
13
+ type: String,
14
+ default: '#333'
15
+ },
16
+ // 背景颜色
17
+ bgColor: {
18
+ type: String,
19
+ default: '#f7f7f7'
20
+ },
21
+ // 弹出框背景颜色
22
+ popupBgColor: {
23
+ type: String,
24
+ default: '#f7f7f7'
25
+ },
26
+ // 弹出框位置
27
+ placement: {
28
+ type: String,
29
+ default: 'top'
30
+ },
31
+ // 触发方式
32
+ triggerMode: {
33
+ type: String,
34
+ default: 'click'
35
+ },
36
+ // 是否显示 (manual模式下使用)
37
+ show: {
38
+ type: Boolean,
39
+ default: false
40
+ },
41
+ // z-index值
42
+ zIndex: {
43
+ type: [Number, String],
44
+ default: 10070
45
+ },
46
+ // 强制定位
47
+ forcePosition: {
48
+ type: Object,
49
+ default() {
50
+ return {}
51
+ }
52
+ },
53
+ // 弹出方向
54
+ direction: {
55
+ type: String,
56
+ default: 'top'
57
+ }
58
+ }
59
+ })
@@ -0,0 +1,95 @@
1
+ <template>
2
+ <view class="up-popover">
3
+ <up-tooltip
4
+ ref="tooltip"
5
+ :text="text"
6
+ :color="color"
7
+ :bg-color="bgColor"
8
+ :popup-bg-color="popupBgColor"
9
+ :placement="placement"
10
+ :trigger-mode="triggerMode"
11
+ :show="show"
12
+ :z-index="zIndex"
13
+ :force-position="forcePosition"
14
+ :direction="direction"
15
+ @open="onOpen"
16
+ @close="onClose"
17
+ @click="onClick"
18
+ >
19
+ <template #trigger>
20
+ <slot name="trigger"></slot>
21
+ </template>
22
+ <template #content>
23
+ <view class="up-popover__content">
24
+ <slot name="content">
25
+ <text>{{text}}</text>
26
+ </slot>
27
+ </view>
28
+ </template>
29
+ </up-tooltip>
30
+ </view>
31
+ </template>
32
+
33
+ <script>
34
+ import { props } from './props';
35
+ import { mpMixin } from '../../libs/mixin/mpMixin';
36
+ import { mixin } from '../../libs/mixin/mixin';
37
+ /**
38
+ * popover 气泡弹出框
39
+ * @description 基于tooltip二次封装的popover组件,用于展示更丰富的内容
40
+ * @tutorial https://www.uviewui.com/components/popover.html
41
+ * @property {String | Number} text 显示的文字内容
42
+ * @property {String} color 文字颜色
43
+ * @property {String} bgColor 背景颜色
44
+ * @property {String} popupBgColor 弹出框背景颜色
45
+ * @property {String} placement 弹出框位置 (top, bottom, left, right)
46
+ * @property {String} triggerMode 触发方式 (hover, click, manual)
47
+ * @property {Boolean} show 是否显示 (manual模式下使用)
48
+ * @property {Number | String} zIndex z-index值
49
+ * @property {Object} forcePosition 强制定位 {top, left, right, bottom}
50
+ * @property {String} direction 弹出方向 (top, bottom, left, right)
51
+ * @event {Function} open 弹出框打开时触发
52
+ * @event {Function} close 弹出框关闭时触发
53
+ * @event {Function} click 点击触发器时触发
54
+ * @example <up-popover text="提示内容"><template #trigger><up-button>点击</up-button></template></up-popover>
55
+ */
56
+ export default {
57
+ name: 'up-popover',
58
+ mixins: [mpMixin, mixin, props],
59
+ data() {
60
+ return {
61
+
62
+ }
63
+ },
64
+ methods: {
65
+ onOpen() {
66
+ this.$emit('open');
67
+ },
68
+ onClose() {
69
+ this.$emit('close');
70
+ },
71
+ onClick() {
72
+ this.$emit('click');
73
+ },
74
+ // 打开popover
75
+ open() {
76
+ this.$refs.tooltip && this.$refs.tooltip.open();
77
+ },
78
+ // 关闭popover
79
+ close() {
80
+ this.$refs.tooltip && this.$refs.tooltip.close();
81
+ }
82
+ }
83
+ }
84
+ </script>
85
+
86
+ <style lang="scss" scoped>
87
+ .up-popover {
88
+
89
+ &__content {
90
+ @include flex;
91
+ align-items: center;
92
+ padding: 12px 16px;
93
+ }
94
+ }
95
+ </style>
@@ -67,5 +67,10 @@ export const props = defineMixin({
67
67
  type: String,
68
68
  default: () => defProps.tooltip.triggerMode
69
69
  },
70
+ // 强制定位
71
+ forcePosition: {
72
+ type: Object,
73
+ default: () => defProps.tooltip.forcePosition
74
+ }
70
75
  }
71
76
  })
@@ -22,6 +22,7 @@ export default {
22
22
  overlay: true,
23
23
  showToast: true,
24
24
  popupBgColor: '',
25
- triggerMode: 'longpress'
25
+ triggerMode: 'longpress',
26
+ forcePosition: {}
26
27
  }
27
28
  }
@@ -29,9 +29,9 @@
29
29
  duration="300"
30
30
  :customStyle="{
31
31
  position: 'absolute',
32
- top: addUnit(tooltipTop),
32
+ top: addUnit(tooltipTop, 'px'),
33
33
  zIndex: zIndex,
34
- ...tooltipStyle
34
+ ...tooltipStyleCpu
35
35
  }"
36
36
  >
37
37
  <view
@@ -145,7 +145,7 @@
145
145
  left: 0
146
146
  },
147
147
  // 文本的位置信息
148
- textInfo: {
148
+ triggerInfo: {
149
149
  width: 0,
150
150
  left: 0
151
151
  },
@@ -155,13 +155,14 @@
155
155
  screenGap: 12,
156
156
  // 三角形指示器的宽高,由于对元素进行了角度旋转,精确计算指示器位置时,需要用到其尺寸信息
157
157
  indicatorWidth: 14,
158
- tooltipStyle: {}
158
+ tooltipStyle: {},
159
+ calcReacted: false
159
160
  }
160
161
  },
161
162
  watch: {
162
163
  async propsChange() {
163
164
  await this.getElRect()
164
- this.getTooltipStyle();
165
+ // this.getTooltipStyle();
165
166
  }
166
167
  },
167
168
  computed: {
@@ -169,29 +170,20 @@
169
170
  // 当一些依赖参数变化时,需要重新计算气泡和指示器的位置信息
170
171
  propsChange() {
171
172
  return [this.text, this.buttons]
172
- }
173
- },
174
- mounted() {
175
- this.init()
176
- },
177
- emits: ["click"],
178
- methods: {
179
- addStyle,
180
- addUnit,
181
- async init() {
182
- await this.getElRect()
183
- this.getTooltipStyle();
184
173
  },
185
174
  // 计算气泡和指示器的位置信息
186
- getTooltipStyle() {
175
+ tooltipStyleCpu() {
176
+ if (!this.calcReacted) {
177
+ return {}
178
+ }
187
179
  const style = {},
188
180
  sysInfo = getWindowInfo()
189
181
  if (this.direction === 'left') {
190
182
  // 右侧显示逻辑
191
183
  style.transform = ``
192
184
  // 垂直居中对齐
193
- style.top = '-' + addUnit((this.tooltipInfo.height - this.indicatorWidth) / 2, 'px')
194
- style.right = addUnit(this.textInfo.width + this.indicatorWidth, 'px')
185
+ style.top = '-' + addUnit((this.triggerInfo.height - this.tooltipInfo.height) / 2, 'px')
186
+ style.right = addUnit(this.triggerInfo.width + this.indicatorWidth, 'px')
195
187
  this.indicatorStyle = {}
196
188
  this.indicatorStyle.right = '-4px'
197
189
  this.indicatorStyle.top = addUnit((this.tooltipInfo.height - this.indicatorWidth) / 2, 'px')
@@ -199,27 +191,27 @@
199
191
  // 右侧显示逻辑
200
192
  style.transform = ``
201
193
  // 垂直居中对齐
202
- style.top = addUnit((this.textInfo.height - this.tooltipInfo.height) / 2, 'px')
203
- style.left = addUnit(this.textInfo.width + this.indicatorWidth, 'px')
194
+ style.top = '-' + addUnit((this.triggerInfo.height - this.tooltipInfo.height) / 2, 'px')
195
+ style.left = addUnit(this.triggerInfo.width + this.indicatorWidth, 'px')
204
196
  this.indicatorStyle = {}
205
197
  this.indicatorStyle.left = '-4px'
206
- this.indicatorStyle.top = addUnit((this.textInfo.height - this.indicatorWidth) / 2, 'px')
198
+ this.indicatorStyle.top = addUnit((this.triggerInfo.height - this.indicatorWidth) / 2, 'px')
207
199
  } else if (this.direction === 'top' || this.direction === 'bottom') {
208
200
  style.transform = `translateY(${this.direction === 'top' ? '-100%' : '100%'})`
209
- if (this.tooltipInfo.width / 2 > this.textInfo.left + this.textInfo.width / 2 - this.screenGap) {
201
+ if (this.tooltipInfo.width / 2 > this.triggerInfo.left + this.triggerInfo.width / 2 - this.screenGap) {
210
202
  this.indicatorStyle = {}
211
- style.left = `-${addUnit(this.textInfo.left - this.screenGap)}`
212
- this.indicatorStyle.left = addUnit(this.textInfo.width / 2 - getPx(style.left) - this.indicatorWidth /
203
+ style.left = `-${addUnit(this.triggerInfo.left - this.screenGap)}`
204
+ this.indicatorStyle.left = addUnit(this.triggerInfo.width / 2 - getPx(style.left) - this.indicatorWidth /
213
205
  2, 'px')
214
- } else if (this.tooltipInfo.width / 2 > sysInfo.windowWidth - this.textInfo.right + this.textInfo.width / 2 -
206
+ } else if (this.tooltipInfo.width / 2 > sysInfo.windowWidth - this.triggerInfo.right + this.triggerInfo.width / 2 -
215
207
  this.screenGap) {
216
208
  this.indicatorStyle = {}
217
- style.right = `-${addUnit(sysInfo.windowWidth - this.textInfo.right - this.screenGap)}`
218
- this.indicatorStyle.right = addUnit(this.textInfo.width / 2 - getPx(style.right) - this
209
+ style.right = `-${addUnit(sysInfo.windowWidth - this.triggerInfo.right - this.screenGap)}`
210
+ this.indicatorStyle.right = addUnit(this.triggerInfo.width / 2 - getPx(style.right) - this
219
211
  .indicatorWidth / 2)
220
212
  } else {
221
- const left = Math.abs(this.textInfo.width / 2 - this.tooltipInfo.width / 2)
222
- style.left = this.textInfo.width > this.tooltipInfo.width ? addUnit(left) : -addUnit(left)
213
+ const left = Math.abs(this.triggerInfo.width / 2 - this.tooltipInfo.width / 2)
214
+ style.left = this.triggerInfo.width > this.tooltipInfo.width ? addUnit(left) : -addUnit(left)
223
215
  this.indicatorStyle = {}
224
216
  }
225
217
  if (this.direction === 'top') {
@@ -230,8 +222,21 @@
230
222
  this.indicatorStyle.top = '-4px'
231
223
  }
232
224
  }
233
- this.tooltipStyle = style
234
- return style
225
+ let styleMerge = {...style, ...this.forcePosition}
226
+ this.tooltipStyle = styleMerge
227
+ return styleMerge
228
+ }
229
+ },
230
+ mounted() {
231
+ this.init()
232
+ },
233
+ emits: ["click"],
234
+ methods: {
235
+ addStyle,
236
+ addUnit,
237
+ async init() {
238
+ await this.getElRect()
239
+ // this.getTooltipStyle();
235
240
  },
236
241
  // 点击触发事件
237
242
  async clickHander() {
@@ -291,7 +296,10 @@
291
296
  this.tooltipInfo = await this.queryRect(this.tooltipId)
292
297
  // 获取气泡尺寸之后,将其隐藏,为了让下次切换气泡显示与隐藏时,有淡入淡出的效果
293
298
  this.showTooltip = false
294
- this.textInfo = await this.queryRect(this.textId)
299
+ this.triggerInfo = await this.queryRect(this.textId)
300
+ sleep(500).then(() => {
301
+ this.calcReacted = true
302
+ })
295
303
  resolve()
296
304
  })
297
305
  })
@@ -33,7 +33,11 @@ uni.onLocaleChange((locale) => {
33
33
  export function t(value, params = {}) {
34
34
  // console.log(settings.locales[settings.lang])
35
35
  if (value) {
36
- let result = settings.locales[settings.lang][value] || value;
36
+ let lang = settings.lang
37
+ if (!settings.locales[settings.lang]) {
38
+ lang = 'zh-Hans'
39
+ }
40
+ let result = settings.locales[lang][value] || value;
37
41
  // 替换{xxx}格式的变量
38
42
  Object.keys(params).forEach(key => {
39
43
  const reg = new RegExp(`{${key}}`, 'g');
@@ -0,0 +1,80 @@
1
+ {
2
+ "up.common.cancel": "ยกเลิก",
3
+ "up.common.confirm": "ยืนยัน",
4
+ "up.common.start": "เริ่มต้น",
5
+ "up.common.end": "สิ้นสุด",
6
+ "up.common.stop": "หยุด",
7
+ "up.common.copy": "คัดลอก",
8
+ "up.common.none": "ไม่มี",
9
+ "up.common.tip": "คำแนะนำ",
10
+ "up.common.success": "สำเร็จ",
11
+ "up.common.fail": "ล้มเหลว",
12
+ "up.common.close": "ปิด",
13
+ "up.common.preview": "ดูตัวอย่าง",
14
+ "up.common.re-select": "เลือกใหม่",
15
+ "up.common.rotate": "หมุน",
16
+ "up.common.pleaseChoose": "กรุณาเลือก",
17
+ "up.common.loading": "กำลังโหลด",
18
+ "up.common.loading2": "กำลังโหลด",
19
+ "up.common.inOperation": "กำลังดำเนินการ",
20
+ "up.common.settings": "การตั้งค่า",
21
+ "up.common.retry": "ลองใหม่",
22
+ "up.common.search": "ค้นหา",
23
+ "up.common.more": "เพิ่มเติม",
24
+ "up.common.video": "วิดีโอ",
25
+ "up.common.file": "ไฟล์",
26
+ "up.week.one": "จันทร์",
27
+ "up.week.two": "อังคาร",
28
+ "up.week.three": "พุธ",
29
+ "up.week.four": "พฤหัสบดี",
30
+ "up.week.five": "ศุกร์",
31
+ "up.week.six": "เสาร์",
32
+ "up.week.seven": "อาทิตย์",
33
+ "up.barcode.error": "สร้างบาร์โค้ดไม่สำเร็จ",
34
+ "up.calendar.chooseDates": "เลือกวันที่",
35
+ "up.calendar.disabled": "วันที่นี้ถูกปิดการใช้งาน",
36
+ "up.calendar.daysExceed": "จำนวนวันที่เลือกต้องไม่เกิน {days} วัน",
37
+ "up.cityLocate.locateCity": "ระบุตำแหน่งเมือง",
38
+ "up.cityLocate.fail": "การระบุตำแหน่งล้มเหลว กรุณาคลิกเพื่อลองใหม่",
39
+ "up.cityLocate.locating": "กำลังระบุตำแหน่ง",
40
+ "up.code.send": "รับรหัสยืนยัน",
41
+ "up.code.resendAfter": "ส่งใหม่ใน X วินาที",
42
+ "up.code.resend": "ส่งใหม่",
43
+ "up.cropper.emptyWidhtOrHeight": "ไม่ได้ตั้งค่าความกว้างหรือความสูงของกรอบตัดภาพ",
44
+ "up.empty.car": "รถเข็นว่างเปล่า",
45
+ "up.empty.page": "ไม่มีหน้านี้",
46
+ "up.empty.search": "ไม่มีผลลัพธ์การค้นหา",
47
+ "up.empty.address": "ไม่มีที่อยู่จัดส่ง",
48
+ "up.empty.wifi": "ไม่มี WiFi",
49
+ "up.empty.order": "ไม่มีคำสั่งซื้อ",
50
+ "up.empty.coupon": "ไม่มีคูปอง",
51
+ "up.empty.favor": "ไม่มีรายการโปรด",
52
+ "up.empty.permission": "ไม่มีสิทธิ์",
53
+ "up.empty.history": "ไม่มีประวัติ",
54
+ "up.empty.news": "ไม่มีรายการข่าว",
55
+ "up.empty.message": "รายการข้อความว่างเปล่า",
56
+ "up.empty.list": "รายการว่างเปล่า",
57
+ "up.empty.data": "ข้อมูลว่างเปล่า",
58
+ "up.empty.comment": "ไม่มีความคิดเห็น",
59
+ "up.link.copyed": "คัดลอกลิงก์แล้ว กรุณาเปิดในเบราว์เซอร์",
60
+ "up.loadmoe.loadmore": "โหลดเพิ่มเติม",
61
+ "up.loadmoe.nomore": "ไม่มีข้อมูลเพิ่มเติม",
62
+ "up.noNetwork.text": "อ๊ะ ขาดการเชื่อมต่อเครือข่าย",
63
+ "up.noNetwork.pleaseCheck": "กรุณาตรวจสอบเครือข่าย หรือไปที่",
64
+ "up.noNetwork.connect": "เชื่อมต่อเครือข่ายแล้ว",
65
+ "up.noNetwork.disconnect": "ไม่มีการเชื่อมต่อเครือข่าย",
66
+ "up.pagination.previous": "หน้าก่อนหน้า",
67
+ "up.pagination.next": "หน้าถัดไป",
68
+ "up.pullRefresh.pull": "ดึงเพื่อรีเฟรช",
69
+ "up.pullRefresh.release": "ปล่อยเพื่อรีเฟรช",
70
+ "up.pullRefresh.refreshing": "กำลังรีเฟรช",
71
+ "up.readMore.expand": "ขยายเพื่ออ่านทั้งหมด",
72
+ "up.readMore.fold": "ย่อ",
73
+ "up.search.placeholder": "กรุณาใส่คำสำคัญ",
74
+ "up.signature.penSize": "ขนาดเส้น",
75
+ "up.signature.penColor": "สีเส้น",
76
+ "up.upload.sizeExceed": "เกินขนาดที่กำหนด",
77
+ "up.upload.uploading": "กำลังอัปโหลด",
78
+ "up.upload.previewImageFail": "ดูตัวอย่างภาพไม่สำเร็จ",
79
+ "up.upload.previewVideoFail": "ดูตัวอย่างวิดีโอไม่สำเร็จ"
80
+ }
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.5.22",
5
+ "version": "3.5.28",
6
6
  "description": "零云®uview-plus已兼容vue3支持多语言,100+全面的组件和便捷的工具会让您信手拈来。近期新增拖动排序、条码、图片裁剪、下拉刷新、虚拟列表、签名、Markdown等。",
7
7
  "keywords": [
8
8
  "uview",