uview-plus 3.1.37 → 3.1.39

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,10 @@
1
+ ## 3.1.39(2023-11-10)
2
+ 修复头条小程序不支持env(safe-area-inset-bottom)
3
+ 优化#201u-grid 指定列数导致闪烁
4
+ #193IndexList 索引列表 高度错误
5
+ 其他优化
6
+ ## 3.1.38(2023-10-08)
7
+ 修复u-slider
1
8
  ## 3.1.37(2023-09-13)
2
9
  完善emits定义及修复code-input双向数据绑定
3
10
  ## 3.1.36(2023-08-08)
@@ -44,6 +44,7 @@ export default {
44
44
  type: [String, Number],
45
45
  default: defprops.codeInput.value
46
46
  },
47
+ // #endif
47
48
  // 是否自动获取焦点
48
49
  focus: {
49
50
  type: Boolean,
@@ -82,7 +82,12 @@
82
82
  }
83
83
  },
84
84
  watch: {
85
+ // #ifdef VUE2
85
86
  value: {
87
+ // #endif
88
+ // #ifdef VUE3
89
+ modelValue: {
90
+ // #endif
86
91
  immediate: true,
87
92
  handler(val) {
88
93
  // 转为字符串,超出部分截掉
@@ -5,6 +5,11 @@ export default {
5
5
  show: {
6
6
  type: Boolean,
7
7
  default: defprops.datetimePicker.show
8
+ },
9
+ // 弹出的方向,可选值为 top bottom right left center
10
+ popupMode: {
11
+ type: String,
12
+ default: defprops.picker.popupMode
8
13
  },
9
14
  // 是否展示顶部的操作栏
10
15
  showToolbar: {
@@ -2,6 +2,7 @@
2
2
  <u-picker
3
3
  ref="picker"
4
4
  :show="show"
5
+ :popupMode="popupMode"
5
6
  :closeOnClickOverlay="closeOnClickOverlay"
6
7
  :columns="columns"
7
8
  :title="title"
@@ -84,6 +85,16 @@
84
85
  this.updateColumnValue(this.innerValue)
85
86
  }
86
87
  },
88
+ // #ifdef VUE3
89
+ modelValue(newValue) {
90
+ this.init()
91
+ },
92
+ // #endif
93
+ // #ifdef VUE2
94
+ value(newValue) {
95
+ this.init()
96
+ },
97
+ // #endif
87
98
  propsChange() {
88
99
  this.init()
89
100
  }
@@ -198,8 +209,12 @@
198
209
  // 更新各列的值,进行补0、格式化等操作
199
210
  updateColumnValue(value) {
200
211
  this.innerValue = value
201
- this.updateColumns()
202
- this.updateIndexs(value)
212
+ this.updateColumns()
213
+ // 延迟执行,等待u-picker组件列数据更新完后再设置选中值索引
214
+ setTimeout(() => {
215
+ this.updateIndexs(value)
216
+ }, 0);
217
+
203
218
  },
204
219
  // 更新索引
205
220
  updateIndexs(value) {
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <!-- #ifndef APP-NVUE -->
3
3
  <view
4
+ v-if="parentData.col > 0"
4
5
  class="u-grid-item"
5
6
  hover-class="u-grid-item--hover-class"
6
7
  :hover-stay-time="200"
@@ -44,7 +45,7 @@
44
45
  data() {
45
46
  return {
46
47
  parentData: {
47
- col: 3, // 父组件划分的宫格数
48
+ col: 0, // 父组件划分的宫格数
48
49
  border: true, // 是否显示边框,根据父组件决定
49
50
  },
50
51
  // #ifdef APP-NVUE
@@ -65,7 +66,11 @@
65
66
  // #ifndef APP-NVUE
66
67
  // vue下放到computed中,否则会因为延时造成闪烁
67
68
  width() {
68
- return 100 / Number(this.parentData.col) + '%'
69
+ if (this.parentData.col > 0) {
70
+ return 100 / Number(this.parentData.col) + '%'
71
+ } else {
72
+ return 0;
73
+ }
69
74
  },
70
75
  // #endif
71
76
  itemStyle() {
@@ -191,7 +191,8 @@
191
191
  // 设置列表的高度为整个屏幕的高度
192
192
  //减去this.customNavHeight,并将this.scrollViewHeight设置为maxHeight
193
193
  //解决当u-index-list组件放在tabbar页面时,scroll-view内容较少时,还能滚动
194
- this.scrollViewHeight = this.sys.windowHeight - this.customNavHeight
194
+ let customNavHeight = uni.$u.getPx(this.customNavHeight)
195
+ this.scrollViewHeight = this.sys.windowHeight - customNavHeight
195
196
  },
196
197
  // 索引列表被触摸
197
198
  touchStart(e) {
@@ -5,6 +5,11 @@ export default {
5
5
  show: {
6
6
  type: Boolean,
7
7
  default: defprops.picker.show
8
+ },
9
+ // 弹出的方向,可选值为 top bottom right left center
10
+ popupMode: {
11
+ type: String,
12
+ default: defprops.picker.popupMode
8
13
  },
9
14
  // 是否展示顶部的操作栏
10
15
  showToolbar: {
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <u-popup
3
3
  :show="show"
4
+ :mode="popupMode"
4
5
  @close="closeHandler"
5
6
  >
6
7
  <view class="u-picker">
@@ -18,7 +19,7 @@
18
19
  class="u-picker__view"
19
20
  :indicatorStyle="`height: ${$u.addUnit(itemHeight)}`"
20
21
  :value="innerIndex"
21
- :immediateChange="immediateChange"
22
+ :immediateChange="true"
22
23
  :style="{
23
24
  height: `${$u.addUnit(visibleItemCount * itemHeight)}`
24
25
  }"
@@ -33,7 +33,7 @@
33
33
  computed: {
34
34
  style() {
35
35
  const style = {};
36
- // #ifdef APP-NVUE
36
+ // #ifdef APP-NVUE || MP-TOUTIAO
37
37
  // nvue下,高度使用js计算填充
38
38
  style.height = uni.$u.addUnit(uni.$u.sys().safeAreaInsets.bottom, 'px');
39
39
  // #endif
@@ -29,6 +29,7 @@ export default {
29
29
  type: [String, Number],
30
30
  default: defprops.slider.value
31
31
  },
32
+ // #endif
32
33
  // 滑块右侧已选择部分的背景色
33
34
  activeColor: {
34
35
  type: String,
@@ -11,6 +11,7 @@ export default {
11
11
  // datetimePicker 组件
12
12
  datetimePicker: {
13
13
  show: false,
14
+ popupMode: 'bottom',
14
15
  showToolbar: true,
15
16
  value: '',
16
17
  title: '',
@@ -11,6 +11,7 @@ export default {
11
11
  // picker
12
12
  picker: {
13
13
  show: false,
14
+ popupMode: 'bottom',
14
15
  showToolbar: true,
15
16
  title: '',
16
17
  columns: () => [],
@@ -170,9 +170,9 @@ function addStyle(customStyle, target = 'object') {
170
170
  * @param {string|number} value 需要添加单位的值
171
171
  * @param {string} unit 添加的单位名 比如px
172
172
  */
173
- function addUnit(value = 'auto', unit = '') {
174
- if (!unit) {
175
- unit = uni.$u.config.unit || 'px'
173
+ function addUnit(value = 'auto', unit = '') {
174
+ if (!unit) {
175
+ unit = uni.$u.config.unit || 'px'
176
176
  }
177
177
  value = String(value)
178
178
  // 用uView内置验证规则中的number判断是否为数值
@@ -212,7 +212,9 @@ function deepMerge(target = {}, source = {}) {
212
212
  for (const prop in source) {
213
213
  if (!source.hasOwnProperty(prop)) continue
214
214
  if (prop in target) {
215
- if (typeof target[prop] !== 'object') {
215
+ if (source[prop] == null) {
216
+ target[prop] = source[prop]
217
+ }else if (typeof target[prop] !== 'object') {
216
218
  target[prop] = source[prop]
217
219
  } else if (typeof source[prop] !== 'object') {
218
220
  target[prop] = source[prop]
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.1.37",
5
+ "version": "3.1.39",
6
6
  "description": "uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
7
7
  "keywords": [
8
8
  "uview",