uview-plus 3.1.52 → 3.2.3

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.
Files changed (42) hide show
  1. package/changelog.md +44 -0
  2. package/components/u-action-sheet/u-action-sheet.vue +1 -1
  3. package/components/u-album/u-album.vue +261 -261
  4. package/components/u-avatar/u-avatar.vue +3 -2
  5. package/components/u-avatar-group/u-avatar-group.vue +106 -106
  6. package/components/u-button/u-button.vue +6 -1
  7. package/components/u-calendar/u-calendar.vue +4 -3
  8. package/components/u-cell/u-cell.vue +4 -2
  9. package/components/u-checkbox/props.js +5 -0
  10. package/components/u-checkbox/u-checkbox.vue +27 -15
  11. package/components/u-code/u-code.vue +1 -1
  12. package/components/u-dropdown/props.js +8 -14
  13. package/components/u-dropdown/u-dropdown.vue +202 -77
  14. package/components/u-dropdown-item/props.js +45 -36
  15. package/components/u-dropdown-item/u-dropdown-item.vue +121 -148
  16. package/components/u-form/u-form.vue +1 -1
  17. package/components/u-form-item/props.js +6 -1
  18. package/components/u-form-item/u-form-item.vue +1 -1
  19. package/components/u-grid/u-grid.vue +4 -2
  20. package/components/u-grid-item/u-grid-item.vue +8 -7
  21. package/components/u-input/u-input.vue +1 -1
  22. package/components/u-lazy-load/u-lazy-load.vue +251 -0
  23. package/components/u-picker/u-picker.vue +4 -1
  24. package/components/u-popup/u-popup.vue +1 -1
  25. package/components/u-read-more/u-read-more.vue +164 -160
  26. package/components/u-slider/u-slider.vue +6 -6
  27. package/components/u-steps-item/u-steps-item.vue +318 -318
  28. package/components/u-subsection/u-subsection.vue +14 -8
  29. package/components/u-swiper/u-swiper.vue +6 -8
  30. package/components/u-tabs/u-tabs.vue +1 -0
  31. package/components/u-tag/props.js +5 -2
  32. package/components/u-text/u-text.vue +226 -226
  33. package/components/u-textarea/u-textarea.vue +275 -275
  34. package/components/u-transition/u-transition.vue +1 -1
  35. package/components/u-waterfall/u-waterfall.vue +225 -0
  36. package/libs/config/props/formItem.js +1 -0
  37. package/libs/config/props/tag.js +30 -29
  38. package/libs/css/common.scss +1 -1
  39. package/libs/css/components.scss +5 -5
  40. package/libs/css/flex.scss +45 -45
  41. package/libs/mixin/mixin.js +2 -2
  42. package/package.json +1 -1
@@ -0,0 +1,225 @@
1
+ <template>
2
+ <view class="u-waterfall">
3
+ <view id="u-left-column" class="u-column">
4
+ <slot name="left" :leftList="leftList"></slot>
5
+ </view>
6
+ <view id="u-right-column" class="u-column">
7
+ <slot name="right" :rightList="rightList"></slot>
8
+ </view>
9
+ </view>
10
+ </template>
11
+
12
+ <script>
13
+ /**
14
+ * waterfall 瀑布流
15
+ * @description 这是一个瀑布流形式的组件,内容分为左右两列,结合uview的懒加载组件效果更佳。相较于某些只是奇偶数左右分别,或者没有利用vue作用域插槽的做法,uview的瀑布流实现了真正的 组件化,搭配LazyLoad 懒加载和loadMore 加载更多组件,让您开箱即用,眼前一亮。
16
+ * @tutorial https://uview-plus.jiangruyi.com/components/waterfall.html
17
+ * @property {Array} flow-list 用于渲染的数据
18
+ * @property {String Number} add-time 单条数据添加到队列的时间间隔,单位ms,见上方注意事项说明(默认200)
19
+ * @example <u-waterfall :flowList="flowList"></u-waterfall>
20
+ */
21
+ export default {
22
+ name: "u-waterfall",
23
+ props: {
24
+ // #ifdef VUE2
25
+ value: {
26
+ // 瀑布流数据
27
+ type: Array,
28
+ required: true,
29
+ default: function() {
30
+ return [];
31
+ }
32
+ },
33
+ // #endif
34
+ // #ifdef VUE3
35
+ modelValue: {
36
+ // 瀑布流数据
37
+ type: Array,
38
+ required: true,
39
+ default: function() {
40
+ return [];
41
+ }
42
+ },
43
+ // #endif
44
+ // 每次向结构插入数据的时间间隔,间隔越长,越能保证两列高度相近,但是对用户体验越不好
45
+ // 单位ms
46
+ addTime: {
47
+ type: [Number, String],
48
+ default: 200
49
+ },
50
+ // id值,用于清除某一条数据时,根据此idKey名称找到并移除,如数据为{idx: 22, name: 'lisa'}
51
+ // 那么该把idKey设置为idx
52
+ idKey: {
53
+ type: String,
54
+ default: 'id'
55
+ }
56
+ },
57
+ data() {
58
+ return {
59
+ leftList: [],
60
+ rightList: [],
61
+ tempList: [],
62
+ children: []
63
+ }
64
+ },
65
+ watch: {
66
+ copyFlowList(nVal, oVal) {
67
+ // 取差值,即这一次数组变化新增的部分
68
+ let startIndex = Array.isArray(oVal) && oVal.length > 0 ? oVal.length : 0;
69
+ // 拼接上原有数据
70
+ this.tempList = this.tempList.concat(this.cloneData(nVal.slice(startIndex)));
71
+ this.splitData();
72
+ }
73
+ },
74
+ mounted() {
75
+ this.tempList = this.cloneData(this.copyFlowList);
76
+ this.splitData();
77
+ },
78
+ computed: {
79
+ // 破坏flowList变量的引用,否则watch的结果新旧值是一样的
80
+ copyFlowList() {
81
+ // #ifdef VUE2
82
+ return this.cloneData(this.value);
83
+ // #endif
84
+ // #ifdef VUE3
85
+ return this.cloneData(this.modelValue);
86
+ // #endif
87
+ }
88
+ },
89
+ emits: ['update:modelValue'],
90
+ methods: {
91
+ async splitData() {
92
+ if (!this.tempList.length) return;
93
+ let leftRect = await this.$uGetRect('#u-left-column');
94
+ let rightRect = await this.$uGetRect('#u-right-column');
95
+ // 如果左边小于或等于右边,就添加到左边,否则添加到右边
96
+ let item = this.tempList[0];
97
+ // 解决多次快速上拉后,可能数据会乱的问题,因为经过上面的两个await节点查询阻塞一定时间,加上后面的定时器干扰
98
+ // 数组可能变成[],导致此item值可能为undefined
99
+ if (!item) return;
100
+ if (leftRect.height < rightRect.height) {
101
+ this.leftList.push(item);
102
+ } else if (leftRect.height > rightRect.height) {
103
+ this.rightList.push(item);
104
+ } else {
105
+ // 这里是为了保证第一和第二张添加时,左右都能有内容
106
+ // 因为添加第一张,实际队列的高度可能还是0,这时需要根据队列元素长度判断下一个该放哪边
107
+ if (this.leftList.length <= this.rightList.length) {
108
+ this.leftList.push(item);
109
+ } else {
110
+ this.rightList.push(item);
111
+ }
112
+ }
113
+ // 移除临时列表的第一项
114
+ this.tempList.splice(0, 1);
115
+ // 如果临时数组还有数据,继续循环
116
+ if (this.tempList.length) {
117
+ setTimeout(() => {
118
+ this.splitData();
119
+ }, this.addTime)
120
+ }
121
+ },
122
+ // 复制而不是引用对象和数组
123
+ cloneData(data) {
124
+ return JSON.parse(JSON.stringify(data));
125
+ },
126
+ // 清空数据列表
127
+ clear() {
128
+ this.leftList = [];
129
+ this.rightList = [];
130
+ // 同时清除父组件列表中的数据
131
+ // #ifdef VUE2
132
+ this.$emit('input', []);
133
+ // #endif
134
+ // #ifdef VUE3
135
+ this.$emit('update:modelValue', []);
136
+ // #endif
137
+ this.tempList = [];
138
+ },
139
+ // 清除某一条指定的数据,根据id实现
140
+ remove(id) {
141
+ // 如果findIndex找不到合适的条件,就会返回-1
142
+ let index = -1;
143
+ index = this.leftList.findIndex(val => val[this.idKey] == id);
144
+ if (index != -1) {
145
+ // 如果index不等于-1,说明已经找到了要找的id,根据index索引删除这一条数据
146
+ this.leftList.splice(index, 1);
147
+ } else {
148
+ // 同理于上方面的方法
149
+ index = this.rightList.findIndex(val => val[this.idKey] == id);
150
+ if (index != -1) this.rightList.splice(index, 1);
151
+ }
152
+ // 同时清除父组件的数据中的对应id的条目
153
+ // #ifdef VUE2
154
+ index = this.value.findIndex(val => val[this.idKey] == id);
155
+ if (index != -1) this.$emit('input', this.value.splice(index, 1));
156
+ // #endif
157
+ // #ifdef VUE3
158
+ index = this.modelvalue.findIndex(val => val[this.idKey] == id);
159
+ if (index != -1) this.$emit('input', this.modelvalue.splice(index, 1));
160
+ // #endif
161
+ },
162
+ // 修改某条数据的某个属性
163
+ modify(id, key, value) {
164
+ // 如果findIndex找不到合适的条件,就会返回-1
165
+ let index = -1;
166
+ index = this.leftList.findIndex(val => val[this.idKey] == id);
167
+ if (index != -1) {
168
+ // 如果index不等于-1,说明已经找到了要找的id,修改对应key的值
169
+ this.leftList[index][key] = value;
170
+ } else {
171
+ // 同理于上方面的方法
172
+ index = this.rightList.findIndex(val => val[this.idKey] == id);
173
+ if (index != -1) this.rightList[index][key] = value;
174
+ }
175
+ // 修改父组件的数据中的对应id的条目
176
+ // #ifdef VUE2
177
+ index = this.value.findIndex(val => val[this.idKey] == id);
178
+ // #endif
179
+ // #ifdef VUE3
180
+ index = this.modelvalue.findIndex(val => val[this.idKey] == id);
181
+ // #endif
182
+ if (index != -1) {
183
+ // 首先复制一份value的数据
184
+ // #ifdef VUE2
185
+ let data = this.cloneData(this.value);
186
+ // #endif
187
+ // #ifdef VUE3
188
+ let data = this.cloneData(this.modelvalue);
189
+ // #endif
190
+ // 修改对应索引的key属性的值为value
191
+ data[index][key] = value;
192
+ // 修改父组件通过v-model绑定的变量的值
193
+ // #ifdef VUE2
194
+ this.$emit('input', data);
195
+ // #endif
196
+ // #ifdef VUE3
197
+ this.$emit('update:modelValue', data);
198
+ // #endif
199
+
200
+ }
201
+ }
202
+ }
203
+ }
204
+ </script>
205
+
206
+ <style lang="scss" scoped>
207
+ @import "../../libs/css/components.scss";
208
+
209
+ .u-waterfall {
210
+ @include flex;
211
+ flex-direction: row;
212
+ align-items: flex-start;
213
+ }
214
+
215
+ .u-column {
216
+ @include flex;
217
+ flex: 1;
218
+ flex-direction: column;
219
+ height: auto;
220
+ }
221
+
222
+ .u-image {
223
+ width: 100%;
224
+ }
225
+ </style>
@@ -14,6 +14,7 @@ export default {
14
14
  prop: '',
15
15
  rule: '',
16
16
  borderBottom: '',
17
+ labelPosition: '',
17
18
  labelWidth: '',
18
19
  rightIcon: '',
19
20
  leftIcon: '',
@@ -1,29 +1,30 @@
1
- /*
2
- * @Author : LQ
3
- * @Description :
4
- * @version : 1.0
5
- * @Date : 2021-08-20 16:44:21
6
- * @LastAuthor : LQ
7
- * @lastTime : 2021-08-20 17:23:37
8
- * @FilePath : /u-view2.0/uview-ui/libs/config/props/tag.js
9
- */
10
- export default {
11
- // tag 组件
12
- tag: {
13
- type: 'primary',
14
- disabled: false,
15
- size: 'medium',
16
- shape: 'square',
17
- text: '',
18
- bgColor: '',
19
- color: '',
20
- borderColor: '',
21
- closeColor: '#C6C7CB',
22
- name: '',
23
- plainFill: false,
24
- plain: false,
25
- closable: false,
26
- show: true,
27
- icon: ''
28
- }
29
- }
1
+ /*
2
+ * @Author : LQ
3
+ * @Description :
4
+ * @version : 1.0
5
+ * @Date : 2021-08-20 16:44:21
6
+ * @LastAuthor : LQ
7
+ * @lastTime : 2021-08-20 17:23:37
8
+ * @FilePath : /u-view2.0/uview-ui/libs/config/props/tag.js
9
+ */
10
+ export default {
11
+ // tag 组件
12
+ tag: {
13
+ type: 'primary',
14
+ disabled: false,
15
+ size: 'medium',
16
+ shape: 'square',
17
+ text: '',
18
+ bgColor: '',
19
+ color: '',
20
+ borderColor: '',
21
+ closeColor: '#C6C7CB',
22
+ name: '',
23
+ plainFill: false,
24
+ plain: false,
25
+ closable: false,
26
+ show: true,
27
+ icon: '',
28
+ iconColor: ''
29
+ }
30
+ }
@@ -1,5 +1,5 @@
1
1
  // 超出行数,自动显示行尾省略号,最多5行
2
- // 来自uView的温馨提示:当您在控制台看到此报错,说明需要在App.vue的style标签加上【lang="scss"】
2
+ // 来自uview-plus的温馨提示:当您在控制台看到此报错,说明需要在App.vue的style标签加上【lang="scss"】
3
3
  @for $i from 1 through 5 {
4
4
  .u-line-#{$i} {
5
5
  /* #ifdef APP-NVUE */
@@ -1,11 +1,11 @@
1
1
  @import "./mixin.scss";
2
2
 
3
3
  /* #ifndef APP-NVUE */
4
- // 由于uView是基于nvue环境进行开发的,此环境中普通元素默认为flex-direction: column;
5
- // 所以在非nvue中,需要对元素进行重置为flex-direction: column; 否则可能会表现异常
6
- view,
7
- scroll-view,
8
- swiper-item,
4
+ // 由于uview-plus是基于nvue环境进行开发的,此环境中普通元素默认为flex-direction: column;
5
+ // 所以在非nvue中,需要对元素进行重置为flex-direction: column; 否则可能会表现异常
6
+ // 2024-04-09由于微信小程序会提示 Some selectors are not allowed in component wxss所以注释以下几行
7
+ // scroll-view,
8
+ // swiper-item,
9
9
  .u-empty,
10
10
  .u-empty__wrap,
11
11
  .u-tabs,
@@ -188,74 +188,74 @@
188
188
  // 以下属于项目(子元素)的类
189
189
 
190
190
  // 子元素交叉轴起点对齐
191
- // .u-flex-self-start {
192
- // align-self: flex-start;
193
- // }
191
+ .u-flex-self-start {
192
+ align-self: flex-start;
193
+ }
194
194
 
195
- // // 子元素交叉轴居中对齐
196
- // .u-flex-self-center {
197
- // align-self: center;
198
- // }
195
+ // 子元素交叉轴居中对齐
196
+ .u-flex-self-center {
197
+ align-self: center;
198
+ }
199
199
 
200
- // // 子元素交叉轴终点对齐
201
- // .u-flex-self-end {
202
- // align-self: flex-end;
203
- // }
200
+ // 子元素交叉轴终点对齐
201
+ .u-flex-self-end {
202
+ align-self: flex-end;
203
+ }
204
204
 
205
205
  // 子元素交叉轴第一行文字基线对齐
206
- // .u-flex-self-baseline {
207
- // align-self: baseline;
208
- // }
206
+ .u-flex-self-baseline {
207
+ align-self: baseline;
208
+ }
209
209
 
210
- // // 子元素交叉轴方向拉伸对齐
211
- // .u-flex-self-stretch {
212
- // align-self: stretch;
213
- // }
210
+ // 子元素交叉轴方向拉伸对齐
211
+ .u-flex-self-stretch {
212
+ align-self: stretch;
213
+ }
214
214
 
215
215
  // 多轴交叉时的对齐方式
216
216
 
217
217
  // 起点对齐
218
- // .u-flex-content-start {
219
- // align-content: flex-start;
220
- // }
218
+ .u-flex-content-start {
219
+ align-content: flex-start;
220
+ }
221
221
 
222
- // // 居中对齐
223
- // .u-flex-content-center {
224
- // align-content: center;
225
- // }
222
+ // 居中对齐
223
+ .u-flex-content-center {
224
+ align-content: center;
225
+ }
226
226
 
227
- // // 终点对齐
228
- // .u-flex-content-end {
229
- // align-content: flex-end;
230
- // }
227
+ // 终点对齐
228
+ .u-flex-content-end {
229
+ align-content: flex-end;
230
+ }
231
231
 
232
- // // 两端对齐
233
- // .u-flex-content-between {
234
- // align-content: space-between;
235
- // }
232
+ // 两端对齐
233
+ .u-flex-content-between {
234
+ align-content: space-between;
235
+ }
236
236
 
237
- // // 均分间距
238
- // .u-flex-content-around {
239
- // align-content: space-around;
240
- // }
237
+ // 均分间距
238
+ .u-flex-content-around {
239
+ align-content: space-around;
240
+ }
241
241
 
242
242
  // 全部居中对齐
243
243
  .u-flex-middle {
244
244
  justify-content: center;
245
245
  align-items: center;
246
- // align-self: center;
247
- // align-content: center;
246
+ align-self: center;
247
+ align-content: center;
248
248
  }
249
249
 
250
250
  // 是否可以放大
251
- // .u-flex-grow {
252
- // flex-grow: 1;
253
- // }
251
+ .u-flex-grow {
252
+ flex-grow: 1;
253
+ }
254
254
 
255
255
  // 是否可以缩小
256
- // .u-flex-shrink {
257
- // flex-shrink: 1;
258
- // }
256
+ .u-flex-shrink {
257
+ flex-shrink: 1;
258
+ }
259
259
 
260
260
  // 定义内外边距,历遍1-80
261
261
  @for $i from 0 through 80 {
@@ -145,8 +145,8 @@ export default {
145
145
  },
146
146
  onReachBottom() {
147
147
  uni.$emit('uOnReachBottom')
148
- },
149
- beforeDestroy() {
148
+ },
149
+ beforeUnmount() {
150
150
  // 判断当前页面是否存在parent和chldren,一般在checkbox和checkbox-group父子联动的场景会有此情况
151
151
  // 组件销毁时,移除子组件在父组件children数组中的实例,释放资源,避免数据混乱
152
152
  if (this.parent && uni.$u.test.array(this.parent.children)) {
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.52",
5
+ "version": "3.2.3",
6
6
  "description": "uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
7
7
  "keywords": [
8
8
  "uview",