uview-plus 3.3.61 → 3.3.64

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,20 @@
1
+ ## 3.3.64(2025-01-18)
2
+ feat: 日历组件支持自定义星期文案
3
+
4
+ ## 3.3.63(2025-01-13)
5
+ fix: cate-tab支持支付宝小程序
6
+
7
+ fix: textarea 修复 placeholder-style
8
+
9
+ fix: 修复在图片加载及加载失败时容器宽度
10
+
11
+ fix: waterfall组件报错Maximum recursive updates
12
+
13
+ ## 3.3.62(2025-01-10)
14
+ feat: sleder滑动选择器双滑块增加外层触发值的变动功能
15
+
16
+ fix: picker支持hasInput优化
17
+
1
18
  ## 3.3.61(2024-12-31)
2
19
  fix: 修复微信getSystemInfoSync接口废弃警告
3
20
 
@@ -37,6 +37,7 @@ export default {
37
37
  showRangePrompt: true,
38
38
  allowSameDay: false,
39
39
  round: 0,
40
- monthNum: 3
40
+ monthNum: 3,
41
+ weekText: ['一', '二', '三', '四', '五', '六', '日']
41
42
  }
42
43
  }
@@ -9,13 +9,13 @@
9
9
  v-if="showSubtitle"
10
10
  >{{ subtitle }}</text>
11
11
  <view class="u-calendar-header__weekdays">
12
- <text class="u-calendar-header__weekdays__weekday">一</text>
13
- <text class="u-calendar-header__weekdays__weekday">二</text>
14
- <text class="u-calendar-header__weekdays__weekday">三</text>
15
- <text class="u-calendar-header__weekdays__weekday">四</text>
16
- <text class="u-calendar-header__weekdays__weekday">五</text>
17
- <text class="u-calendar-header__weekdays__weekday">六</text>
18
- <text class="u-calendar-header__weekdays__weekday">日</text>
12
+ <text class="u-calendar-header__weekdays__weekday">{{ weekText[0] }}</text>
13
+ <text class="u-calendar-header__weekdays__weekday">{{ weekText[1] }}</text>
14
+ <text class="u-calendar-header__weekdays__weekday">{{ weekText[2] }}</text>
15
+ <text class="u-calendar-header__weekdays__weekday">{{ weekText[3] }}</text>
16
+ <text class="u-calendar-header__weekdays__weekday">{{ weekText[4] }}</text>
17
+ <text class="u-calendar-header__weekdays__weekday">{{ weekText[5] }}</text>
18
+ <text class="u-calendar-header__weekdays__weekday">{{ weekText[6] }}</text>
19
19
  </view>
20
20
  </view>
21
21
  </template>
@@ -47,6 +47,13 @@
47
47
  type: Boolean,
48
48
  default: true
49
49
  },
50
+ // 星期文本
51
+ weekText: {
52
+ type: Boolean,
53
+ default: () => {
54
+ return ['一', '二', '三', '四', '五', '六', '日']
55
+ }
56
+ },
50
57
  },
51
58
  data() {
52
59
  return {
@@ -142,6 +142,11 @@ export const props = defineMixin({
142
142
  monthNum: {
143
143
  type: [Number, String],
144
144
  default: 3
145
- }
145
+ },
146
+ // 星期文案
147
+ weekText: {
148
+ type: Array,
149
+ default: defProps.calendar.weekText
150
+ }
146
151
  }
147
152
  })
@@ -13,6 +13,7 @@
13
13
  :subtitle="subtitle"
14
14
  :showSubtitle="showSubtitle"
15
15
  :showTitle="showTitle"
16
+ :weekText="weekText"
16
17
  ></uHeader>
17
18
  <scroll-view
18
19
  :style="{
@@ -106,6 +107,7 @@ import test from '../../libs/function/test';
106
107
  * @property {Boolean} allowSameDay 是否允许日期范围的起止时间为同一天,mode = range时有效 (默认 false )
107
108
  * @property {Number|String} round 圆角值,默认无圆角 (默认 0 )
108
109
  * @property {Number|String} monthNum 最多展示的月份数量 (默认 3 )
110
+ * @property {Array} weekText 星期文案 (默认 ['一', '二', '三', '四', '五', '六', '日'] )
109
111
  *
110
112
  * @event {Function()} confirm 点击确定按钮时触发 选择日期相关的返回参数
111
113
  * @event {Function()} close 日历关闭时触发 可定义页面关闭时的回调事件
@@ -7,16 +7,18 @@
7
7
  <view v-for="(item, index) in tabList" :key="index" class="u-cate-tab__item"
8
8
  :class="[current == index ? 'u-cate-tab__item-active' : '']"
9
9
  @tap.stop="swichMenu(index)">
10
- <slot name="tabItem" :item="item">
11
- <text class="u-line-1">{{item[tabKeyName]}}</text>
10
+ <slot name="tabItem" :item="item">
12
11
  </slot>
12
+ <text v-if="!$slots['tabItem']" class="u-line-1">{{item[tabKeyName]}}</text>
13
13
  </view>
14
14
  </scroll-view>
15
15
  <scroll-view :scroll-top="scrollRightTop" scroll-y scroll-with-animation class="u-cate-tab__right-box" @scroll="rightScroll">
16
16
  <view class="u-cate-tab__page-view">
17
17
  <view class="u-cate-tab__page-item" :id="'item' + index" v-for="(item , index) in tabList" :key="index">
18
18
  <slot name="itemList" :item="item">
19
- <view class="item-title">
19
+ </slot>
20
+ <template v-if="!$slots['itemList']">
21
+ <view class="item-title">
20
22
  <text>{{item[tabKeyName]}}</text>
21
23
  </view>
22
24
  <view class="item-container">
@@ -29,7 +31,7 @@
29
31
  </slot>
30
32
  </template>
31
33
  </view>
32
- </slot>
34
+ </template>
33
35
  </view>
34
36
  </view>
35
37
  </scroll-view>
@@ -38,6 +40,7 @@
38
40
  </template>
39
41
  <script>
40
42
  export default {
43
+ name: 'up-cate-tab',
41
44
  props: {
42
45
  tabList: {
43
46
  type: Array,
@@ -140,7 +143,7 @@
140
143
  // 获取右边菜单每个item到顶部的距离
141
144
  getMenuItemTop() {
142
145
  new Promise(resolve => {
143
- let selectorQuery = uni.createSelectorQuery();
146
+ let selectorQuery = uni.createSelectorQuery().in(this);
144
147
  selectorQuery.selectAll('.u-cate-tab__page-item').boundingClientRect((rects) => {
145
148
  // 如果节点尚未生成,rects值为[](因为用selectAll,所以返回的是数组),循环调用执行
146
149
  if(!rects.length) {
@@ -262,6 +265,7 @@
262
265
  }
263
266
 
264
267
  .u-cate-tab__right-box {
268
+ flex: 1;
265
269
  background-color: rgb(250, 250, 250);
266
270
  }
267
271
 
@@ -81,6 +81,16 @@
81
81
  */
82
82
  export default {
83
83
  name: 'u-icon',
84
+ beforeCreate() {
85
+ // #ifdef APP-NVUE
86
+ if (this.customFontFamily) {
87
+ domModule.addRule('fontFace', {
88
+ 'fontFamily': `${this.customPrefix}-${this.customFontFamily}`,
89
+ 'src': `url('${this.customFontUrl}')`
90
+ })
91
+ }
92
+ // #endif
93
+ },
84
94
  data() {
85
95
  return {
86
96
 
@@ -136,7 +146,9 @@
136
146
  // 通过图标名,查找对应的图标
137
147
  icon() {
138
148
  // 使用自定义图标的时候页面上会把name属性也展示出来,所以在这里处理一下
139
- if (this.customPrefix !== "uicon") return "";
149
+ if (this.customPrefix !== "uicon") {
150
+ return this.customIcons[this.customPrefix + '-' + this.name] || this.name;
151
+ }
140
152
  // 如果内置的图标中找不到对应的图标,就直接返回name值,因为用户可能传入的是unicode代码
141
153
  return icons['uicon-' + this.name] || this.name
142
154
  }
@@ -132,12 +132,12 @@
132
132
  style.height = addUnit(this.height);
133
133
  // #endif
134
134
  // #ifndef APP-NVUE
135
- if (this.width == '100%') {
135
+ if (this.loading || this.isError || this.width == '100%' || this.mode != 'heightFix') {
136
136
  style.width = this.width;
137
137
  } else {
138
138
  style.width = 'fit-content';
139
139
  }
140
- if (this.height == '100%') {
140
+ if (this.loading || this.isError || this.height == '100%' || this.mode != 'widthFix') {
141
141
  style.height = this.height;
142
142
  } else {
143
143
  style.height = 'fit-content';
@@ -153,12 +153,12 @@
153
153
  style.height = addUnit(this.height);
154
154
  // #endif
155
155
  // #ifndef APP-NVUE
156
- if (this.width == '100%') {
156
+ if (this.loading || this.isError || this.width == '100%' || this.mode != 'heightFix') {
157
157
  style.width = this.width;
158
158
  } else {
159
159
  style.width = 'fit-content';
160
160
  }
161
- if (this.height == '100%') {
161
+ if (this.loading || this.isError || this.height == '100%' || this.mode != 'widthFix') {
162
162
  style.height = this.height;
163
163
  } else {
164
164
  style.height = 'fit-content';
@@ -1,12 +1,11 @@
1
1
  <template>
2
2
  <view class="u-picker-warrper">
3
- <view v-if="hasInput" class="u-picker-input cursor-pointer" @click="showByClickInput = !showByClickInput">
4
- <slot>
5
- <view>
6
- {{ inputLabel && inputLabel.length ? inputLabel.join('/') : placeholder }}
7
- </view>
8
- </slot>
9
- </view>
3
+ <view v-if="hasInput" class="u-picker-input cursor-pointer" @click="showByClickInput = !showByClickInput">
4
+ <slot>
5
+ <up-input :placeholder="placeholder" :readonly="true" border="surround" v-model="inputLabel"></up-input>
6
+ <div class="input-cover"></div>
7
+ </slot>
8
+ </view>
10
9
  <u-popup
11
10
  :show="show || (hasInput && showByClickInput)"
12
11
  :mode="popupMode"
@@ -114,6 +113,7 @@ export default {
114
113
  // 上一次的变化列索引
115
114
  columnIndex: 0,
116
115
  showByClickInput: false,
116
+ currentActiveValue: [] //当前用户选中,但是还没确认的值,用户没做change操作时候,点击确认可以默认选中第一个
117
117
  }
118
118
  },
119
119
  watch: {
@@ -121,8 +121,13 @@ export default {
121
121
  defaultIndex: {
122
122
  immediate: true,
123
123
  deep:true,
124
- handler(n) {
125
- this.setIndexs(n, true)
124
+ handler(n,o) {
125
+ // 修复uniapp调用子组件直接:defaultIndex="[0]"这样写
126
+ // v-model的值变化时候导致defaultIndexwatch也会执行的问题
127
+ //单纯vue不会出现
128
+ if (!o || n.join("/") != o.join("/")) {
129
+ this.setIndexs(n, true)
130
+ }
126
131
  }
127
132
  },
128
133
  // 监听columns参数的变化
@@ -136,22 +141,38 @@ export default {
136
141
  },
137
142
  emits: ['close', 'cancel', 'confirm', 'change', 'update:modelValue', 'update:show'],
138
143
  computed: {
139
- inputLabel() {
140
- let items = this.innerColumns.map((item, index) => item[this.innerIndex[index]])
141
- let res = []
142
- items.forEach(element => {
143
- res.push(element[this.keyName])
144
- });
145
- return res
146
- },
147
- inputValue() {
148
- let items = this.innerColumns.map((item, index) => item[this.innerIndex[index]])
149
- let res = []
150
- items.forEach(element => {
151
- res.push(element['id'])
152
- });
153
- return res
154
- }
144
+ //已选&&已确认的值显示在input上面的文案
145
+ inputLabel() {
146
+ let firstItem = this.innerColumns[0] && this.innerColumns[0][0];
147
+ // //区分是不是对象数组
148
+ if (firstItem && Object.prototype.toString.call(firstItem) === '[object Object]') {
149
+ let res = this.innerColumns[0].filter(item => this.modelValue.includes(item['id']))
150
+ res = res.map(item => item[this.keyName]);
151
+ return res.join("/");
152
+
153
+ } else {
154
+ //用户确定的值,才显示到输入框
155
+ return this.modelValue.join("/");
156
+ }
157
+ },
158
+ //已选,待确认的值
159
+ inputValue() {
160
+ let items = this.innerColumns.map((item, index) => item[this.innerIndex[index]])
161
+ let res = []
162
+ //区分是不是对象数组
163
+ if (items[0] && Object.prototype.toString.call(items[0]) === '[object Object]') {
164
+ //对象数组返回id集合
165
+ items.forEach(element => {
166
+ res.push(element && element['id'])
167
+ });
168
+ } else {
169
+ //非对象数组返回元素集合
170
+ items.forEach((element, index) => {
171
+ res.push(element)
172
+ });
173
+ }
174
+ return res
175
+ }
155
176
  },
156
177
  methods: {
157
178
  addUnit,
@@ -184,6 +205,19 @@ export default {
184
205
  },
185
206
  // 点击工具栏的确定按钮
186
207
  confirm() {
208
+ //如果用户有没有触发过change
209
+ if (!this.currentActiveValue.length) {
210
+ let arr = [0]
211
+ //如果有默认值&&默认值的数组长度是正确的,就用默认值
212
+ if (Array.isArray(this.defaultIndex) && this.defaultIndex.length == this.innerColumns.length) {
213
+ arr = [...this.defaultIndex];
214
+ } else {
215
+ //否则默认都选中第一个
216
+ arr = Array(this.innerColumns.length).fill(0);
217
+ }
218
+ this.setLastIndex(arr)
219
+ this.setIndexs(arr)
220
+ }
187
221
  this.$emit('update:modelValue', this.inputValue)
188
222
  if (this.hasInput) {
189
223
  this.showByClickInput = false
@@ -202,6 +236,8 @@ export default {
202
236
  } = e.detail
203
237
  let index = 0,
204
238
  columnIndex = 0
239
+ //记录用户选中但是还没确认的值
240
+ this.currentActiveValue = value;
205
241
  // 通过对比前后两次的列索引,得出当前变化的是哪一列
206
242
  for (let i = 0; i < value.length; i++) {
207
243
  let item = value[i]
@@ -218,9 +254,11 @@ export default {
218
254
  // 将当前的各项变化索引,设置为"上一次"的索引变化值
219
255
  this.setLastIndex(value)
220
256
  this.setIndexs(value)
221
-
222
- this.$emit('update:modelValue', this.inputValue)
223
-
257
+ //如果是非自带输入框才会在change时候触发v-model绑值的变化
258
+ //否则会非常的奇怪,用户未确认,值就变了
259
+ if (!this.hasInput) {
260
+ this.$emit('update:modelValue', this.inputValue)
261
+ }
224
262
  this.$emit('change', {
225
263
  // #ifndef MP-WEIXIN || MP-LARK
226
264
  // 微信小程序不能传递this,会因为循环引用而报错
@@ -303,7 +341,18 @@ export default {
303
341
 
304
342
  .u-picker {
305
343
  position: relative;
306
-
344
+ &-input {
345
+ position: relative;
346
+ .input-cover {
347
+ opacity: 0;
348
+ position: absolute;
349
+ top: 0;
350
+ bottom: 0;
351
+ left: 0;
352
+ right: 0;
353
+ z-index:1;
354
+ }
355
+ }
307
356
  &__view {
308
357
 
309
358
  &__column {
@@ -45,6 +45,7 @@
45
45
  class="u-search__content__input"
46
46
  type="text"
47
47
  :style="[{
48
+ pointerEvents: disabled ? 'none' : 'auto',
48
49
  textAlign: inputAlign,
49
50
  color: color,
50
51
  backgroundColor: bgColor,
@@ -155,8 +155,17 @@
155
155
  value(n) {
156
156
  // 只有在非滑动状态时,才可以通过value更新滑块值,这里监听,是为了让用户触发
157
157
  if(this.status == 'end') this.updateValue(this.value, false);
158
- }
158
+ },
159
159
  // #endif
160
+ rangeValue:{
161
+ handler(n){
162
+ if(this.status == 'end'){
163
+ this.updateValue(this.rangeValue[0], false, 0);
164
+ this.updateValue(this.rangeValue[1], false, 1);
165
+ }
166
+ },
167
+ deep:true
168
+ }
160
169
  },
161
170
  created() {
162
171
  },
@@ -5,7 +5,7 @@
5
5
  :value="innerValue"
6
6
  :style="{ height: addUnit(height) }"
7
7
  :placeholder="placeholder"
8
- :placeholder-style="addStyle(placeholderStyle, 'string')"
8
+ :placeholder-style="addStyle(placeholderStyle, typeof placeholderStyle === 'string' ? 'string' : 'object')"
9
9
  :placeholder-class="placeholderClass"
10
10
  :disabled="disabled"
11
11
  :focus="focus"
@@ -68,7 +68,7 @@
68
68
  watch: {
69
69
  copyFlowList(nVal, oVal) {
70
70
  if (!nVal || nVal.length == 0) {
71
- this.clear();
71
+ this.clear(false);
72
72
  // console.log('clear');
73
73
  } else {
74
74
  // 取差值,即这一次数组变化新增的部分
@@ -88,7 +88,7 @@
88
88
  copyFlowList() {
89
89
  // #ifdef VUE3
90
90
  if (!this.modelValue || this.modelValue.length == 0) {
91
- this.clear();
91
+ this.clear(false);
92
92
  // console.log('clear');
93
93
  return [];
94
94
  } else {
@@ -138,16 +138,18 @@
138
138
  return JSON.parse(JSON.stringify(data));
139
139
  },
140
140
  // 清空数据列表
141
- clear() {
141
+ clear(bak = true) {
142
142
  this.leftList = [];
143
143
  this.rightList = [];
144
144
  // 同时清除父组件列表中的数据
145
- // #ifdef VUE2
146
- this.$emit('input', []);
147
- // #endif
148
- // #ifdef VUE3
149
- this.$emit('update:modelValue', []);
150
- // #endif
145
+ if (bak) {
146
+ // #ifdef VUE2
147
+ this.$emit('input', []);
148
+ // #endif
149
+ // #ifdef VUE3
150
+ this.$emit('update:modelValue', []);
151
+ // #endif
152
+ }
151
153
  this.tempList = [];
152
154
  },
153
155
  // 清除某一条指定的数据,根据id实现
@@ -241,4 +243,4 @@
241
243
  max-width: 100%;
242
244
  /* #endif */
243
245
  }
244
- </style>
246
+ </style>
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.3.61",
5
+ "version": "3.3.64",
6
6
  "description": "零云®uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
7
7
  "keywords": [
8
8
  "uview",