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
@@ -1,318 +1,318 @@
1
- <template>
2
- <view class="u-steps-item" ref="u-steps-item" :class="[`u-steps-item--${parentData.direction}`]">
3
- <view class="u-steps-item__line" v-if="index + 1 < childLength"
4
- :class="[`u-steps-item__line--${parentData.direction}`]" :style="[lineStyle]"></view>
5
- <view class="u-steps-item__wrapper"
6
- :class="[`u-steps-item__wrapper--${parentData.direction}`, parentData.dot && `u-steps-item__wrapper--${parentData.direction}--dot`]">
7
- <slot name="icon">
8
- <view class="u-steps-item__wrapper__dot" v-if="parentData.dot" :style="{
9
- backgroundColor: statusColor
10
- }">
11
-
12
- </view>
13
- <view class="u-steps-item__wrapper__icon" v-else-if="parentData.activeIcon || parentData.inactiveIcon">
14
- <u-icon :name="index <= parentData.current ? parentData.activeIcon : parentData.inactiveIcon"
15
- :size="iconSize"
16
- :color="index <= parentData.current ? parentData.activeColor : parentData.inactiveColor">
17
- </u-icon>
18
- </view>
19
- <view v-else :style="{
20
- backgroundColor: statusClass === 'process' ? parentData.activeColor : 'transparent',
21
- borderColor: statusColor
22
- }" class="u-steps-item__wrapper__circle">
23
- <text v-if="statusClass === 'process' || statusClass === 'wait'"
24
- class="u-steps-item__wrapper__circle__text" :style="{
25
- color: index == parentData.current ? '#ffffff' : parentData.inactiveColor
26
- }">{{ index + 1}}</text>
27
- <u-icon v-else :color="statusClass === 'error' ? 'error' : parentData.activeColor" size="12"
28
- :name="statusClass === 'error' ? 'close' : 'checkmark'"></u-icon>
29
- </view>
30
- </slot>
31
- </view>
32
- <view class="u-steps-item__content" :class="[`u-steps-item__content--${parentData.direction}`]"
33
- :style="[contentStyle]">
34
- <u--text :text="title" :type="parentData.current == index ? 'main' : 'content'" lineHeight="20px"
35
- :size="parentData.current == index ? 14 : 13"></u--text>
36
- <slot name="desc">
37
- <u--text :text="desc" type="tips" size="12"></u--text>
38
- </slot>
39
- </view>
40
- <!-- <view
41
- class="u-steps-item__line"
42
- v-if="showLine && parentData.direction === 'column'"
43
- :class="[`u-steps-item__line--${parentData.direction}`]"
44
- :style="[lineStyle]"
45
- ></view> -->
46
- </view>
47
- </template>
48
-
49
- <script>
50
- import props from './props.js';
51
- import mpMixin from '../../libs/mixin/mpMixin.js';
52
- import mixin from '../../libs/mixin/mixin.js';
53
- // #ifdef APP-NVUE
54
- const dom = uni.requireNativePlugin('dom')
55
- // #endif
56
- /**
57
- * StepsItem 步骤条的子组件
58
- * @description 本组件需要和u-steps配合使用
59
- * @tutorial https://uview-plus.jiangruyi.com/components/steps.html
60
- * @property {String} title 标题文字
61
- * @property {String} current 描述文本
62
- * @property {String | Number} iconSize 图标大小 (默认 17 )
63
- * @property {Boolean} error 当前步骤是否处于失败状态 (默认 false )
64
- * @example <u-steps current="0"><u-steps-item title="已出库" desc="10:35" ></u-steps-item></u-steps>
65
- */
66
- export default {
67
- name: 'u-steps-item',
68
- mixins: [mpMixin, mixin, props],
69
- data() {
70
- return {
71
- index: 0,
72
- childLength: 0,
73
- showLine: false,
74
- size: {
75
- height: 0,
76
- width: 0
77
- },
78
- parentData: {
79
- direction: 'row',
80
- current: 0,
81
- activeColor: '',
82
- inactiveColor: '',
83
- activeIcon: '',
84
- inactiveIcon: '',
85
- dot: false
86
- }
87
- }
88
- },
89
- watch: {
90
- 'parentData'(newValue, oldValue) {
91
- }
92
- },
93
- created() {
94
- this.init()
95
- },
96
- computed: {
97
- lineStyle() {
98
- const style = {}
99
- if (this.parentData.direction === 'row') {
100
- style.width = this.size.width + 'px'
101
- style.left = this.size.width / 2 + 'px'
102
- } else {
103
- style.height = this.size.height + 'px'
104
- // style.top = this.size.height / 2 + 'px'
105
- }
106
- style.backgroundColor = this.parent.children?.[this.index + 1]?.error ? uni.$u.color.error : this.index <
107
- this
108
- .parentData
109
- .current ? this.parentData.activeColor : this.parentData.inactiveColor
110
- return style
111
- },
112
- statusClass() {
113
- const {
114
- index,
115
- error
116
- } = this
117
- const {
118
- current
119
- } = this.parentData
120
- if (current == index) {
121
- return error === true ? 'error' : 'process'
122
- } else if (error) {
123
- return 'error'
124
- } else if (current > index) {
125
- return 'finish'
126
- } else {
127
- return 'wait'
128
- }
129
- },
130
- statusColor() {
131
- let color = ''
132
- switch (this.statusClass) {
133
- case 'finish':
134
- color = this.parentData.activeColor
135
- break
136
- case 'error':
137
- color = uni.$u.color.error
138
- break
139
- case 'process':
140
- color = this.parentData.dot ? this.parentData.activeColor : 'transparent'
141
- break
142
- default:
143
- color = this.parentData.inactiveColor
144
- break
145
- }
146
- return color
147
- },
148
- contentStyle() {
149
- const style = {}
150
- if (this.parentData.direction === 'column') {
151
- style.marginLeft = this.parentData.dot ? '2px' : '6px'
152
- style.marginTop = this.parentData.dot ? '0px' : '6px'
153
- } else {
154
- style.marginTop = this.parentData.dot ? '2px' : '6px'
155
- style.marginLeft = this.parentData.dot ? '2px' : '6px'
156
- }
157
-
158
- return style
159
- }
160
- },
161
- mounted() {
162
- this.parent && this.parent.updateFromChild()
163
- uni.$u.sleep().then(() => {
164
- this.getStepsItemRect()
165
- })
166
- },
167
- methods: {
168
- init() {
169
- // 初始化数据
170
- this.updateParentData()
171
- if (!this.parent) {
172
- return uni.$u.error('u-steps-item必须要搭配u-steps组件使用')
173
- }
174
- this.index = this.parent.children.indexOf(this)
175
- this.childLength = this.parent.children.length
176
- },
177
- updateParentData() {
178
- // 此方法在mixin中
179
- this.getParentData('u-steps')
180
- },
181
- // 父组件数据发生变化
182
- updateFromParent() {
183
- this.init()
184
- },
185
- // 获取组件的尺寸,用于设置横线的位置
186
- getStepsItemRect() {
187
- // #ifndef APP-NVUE
188
- this.$uGetRect('.u-steps-item').then(size => {
189
- this.size = size
190
- })
191
- // #endif
192
-
193
- // #ifdef APP-NVUE
194
- dom.getComponentRect(this.$refs['u-steps-item'], res => {
195
- const {
196
- size
197
- } = res
198
- this.size = size
199
- })
200
- // #endif
201
- }
202
- }
203
- }
204
- </script>
205
-
206
- <style lang="scss" scoped>
207
- @import "../../libs/css/components.scss";
208
-
209
- .u-steps-item {
210
- flex: 1;
211
- @include flex;
212
-
213
- &--row {
214
- flex-direction: column;
215
- align-items: center;
216
- position: relative;
217
- }
218
-
219
- &--column {
220
- position: relative;
221
- flex-direction: row;
222
- justify-content: flex-start;
223
- padding-bottom: 5px;
224
- }
225
-
226
- &__wrapper {
227
- @include flex;
228
- justify-content: center;
229
- align-items: center;
230
- position: relative;
231
- background-color: #fff;
232
-
233
- &--column {
234
- width: 20px;
235
- height: 32px;
236
-
237
- &--dot {
238
- height: 20px;
239
- width: 20px;
240
- }
241
- }
242
-
243
- &--row {
244
- width: 32px;
245
- height: 20px;
246
-
247
- &--dot {
248
- width: 20px;
249
- height: 20px;
250
- }
251
- }
252
-
253
- &__circle {
254
- width: 20px;
255
- height: 20px;
256
- /* #ifndef APP-NVUE */
257
- box-sizing: border-box;
258
- flex-shrink: 0;
259
- /* #endif */
260
- border-radius: 100px;
261
- border-width: 1px;
262
- border-color: $u-tips-color;
263
- border-style: solid;
264
- @include flex(row);
265
- align-items: center;
266
- justify-content: center;
267
- transition: background-color 0.3s;
268
-
269
- &__text {
270
- color: $u-tips-color;
271
- font-size: 11px;
272
- @include flex(row);
273
- align-items: center;
274
- justify-content: center;
275
- text-align: center;
276
- line-height: 11px;
277
- }
278
- }
279
-
280
- &__dot {
281
- width: 10px;
282
- height: 10px;
283
- border-radius: 100px;
284
- background-color: $u-content-color;
285
- }
286
- }
287
-
288
- &__content {
289
- @include flex;
290
- flex: 1;
291
-
292
- &--row {
293
- flex-direction: column;
294
- align-items: center;
295
- }
296
-
297
- &--column {
298
- flex-direction: column;
299
- margin-left: 6px;
300
- }
301
- }
302
-
303
- &__line {
304
- position: absolute;
305
- background: $u-tips-color;
306
-
307
- &--row {
308
- top: 10px;
309
- height: 1px;
310
- }
311
-
312
- &--column {
313
- width: 1px;
314
- left: 10px;
315
- }
316
- }
317
- }
318
- </style>
1
+ <template>
2
+ <view class="u-steps-item" ref="u-steps-item" :class="[`u-steps-item--${parentData.direction}`]">
3
+ <view class="u-steps-item__line" v-if="index + 1 < childLength"
4
+ :class="[`u-steps-item__line--${parentData.direction}`]" :style="[lineStyle]"></view>
5
+ <view class="u-steps-item__wrapper"
6
+ :class="[`u-steps-item__wrapper--${parentData.direction}`, parentData.dot && `u-steps-item__wrapper--${parentData.direction}--dot`]">
7
+ <slot name="icon">
8
+ <view class="u-steps-item__wrapper__dot" v-if="parentData.dot" :style="{
9
+ backgroundColor: statusColor
10
+ }">
11
+
12
+ </view>
13
+ <view class="u-steps-item__wrapper__icon" v-else-if="parentData.activeIcon || parentData.inactiveIcon">
14
+ <u-icon :name="index <= parentData.current ? parentData.activeIcon : parentData.inactiveIcon"
15
+ :size="iconSize"
16
+ :color="index <= parentData.current ? parentData.activeColor : parentData.inactiveColor">
17
+ </u-icon>
18
+ </view>
19
+ <view v-else :style="{
20
+ backgroundColor: statusClass === 'process' ? parentData.activeColor : 'transparent',
21
+ borderColor: statusColor
22
+ }" class="u-steps-item__wrapper__circle">
23
+ <text v-if="statusClass === 'process' || statusClass === 'wait'"
24
+ class="u-steps-item__wrapper__circle__text" :style="{
25
+ color: index == parentData.current ? '#ffffff' : parentData.inactiveColor
26
+ }">{{ index + 1}}</text>
27
+ <u-icon v-else :color="statusClass === 'error' ? 'error' : parentData.activeColor" size="12"
28
+ :name="statusClass === 'error' ? 'close' : 'checkmark'"></u-icon>
29
+ </view>
30
+ </slot>
31
+ </view>
32
+ <view class="u-steps-item__content" :class="[`u-steps-item__content--${parentData.direction}`]"
33
+ :style="[contentStyle]">
34
+ <up-text :text="title" :type="parentData.current == index ? 'main' : 'content'" lineHeight="20px"
35
+ :size="parentData.current == index ? 14 : 13"></up-text>
36
+ <slot name="desc">
37
+ <up-text :text="desc" type="tips" size="12"></up-text>
38
+ </slot>
39
+ </view>
40
+ <!-- <view
41
+ class="u-steps-item__line"
42
+ v-if="showLine && parentData.direction === 'column'"
43
+ :class="[`u-steps-item__line--${parentData.direction}`]"
44
+ :style="[lineStyle]"
45
+ ></view> -->
46
+ </view>
47
+ </template>
48
+
49
+ <script>
50
+ import props from './props.js';
51
+ import mpMixin from '../../libs/mixin/mpMixin.js';
52
+ import mixin from '../../libs/mixin/mixin.js';
53
+ // #ifdef APP-NVUE
54
+ const dom = uni.requireNativePlugin('dom')
55
+ // #endif
56
+ /**
57
+ * StepsItem 步骤条的子组件
58
+ * @description 本组件需要和u-steps配合使用
59
+ * @tutorial https://uview-plus.jiangruyi.com/components/steps.html
60
+ * @property {String} title 标题文字
61
+ * @property {String} current 描述文本
62
+ * @property {String | Number} iconSize 图标大小 (默认 17 )
63
+ * @property {Boolean} error 当前步骤是否处于失败状态 (默认 false )
64
+ * @example <u-steps current="0"><u-steps-item title="已出库" desc="10:35" ></u-steps-item></u-steps>
65
+ */
66
+ export default {
67
+ name: 'u-steps-item',
68
+ mixins: [mpMixin, mixin, props],
69
+ data() {
70
+ return {
71
+ index: 0,
72
+ childLength: 0,
73
+ showLine: false,
74
+ size: {
75
+ height: 0,
76
+ width: 0
77
+ },
78
+ parentData: {
79
+ direction: 'row',
80
+ current: 0,
81
+ activeColor: '',
82
+ inactiveColor: '',
83
+ activeIcon: '',
84
+ inactiveIcon: '',
85
+ dot: false
86
+ }
87
+ }
88
+ },
89
+ watch: {
90
+ 'parentData'(newValue, oldValue) {
91
+ }
92
+ },
93
+ created() {
94
+ this.init()
95
+ },
96
+ computed: {
97
+ lineStyle() {
98
+ const style = {}
99
+ if (this.parentData.direction === 'row') {
100
+ style.width = this.size.width + 'px'
101
+ style.left = this.size.width / 2 + 'px'
102
+ } else {
103
+ style.height = this.size.height + 'px'
104
+ // style.top = this.size.height / 2 + 'px'
105
+ }
106
+ style.backgroundColor = this.parent.children?.[this.index + 1]?.error ? uni.$u.color.error : this.index <
107
+ this
108
+ .parentData
109
+ .current ? this.parentData.activeColor : this.parentData.inactiveColor
110
+ return style
111
+ },
112
+ statusClass() {
113
+ const {
114
+ index,
115
+ error
116
+ } = this
117
+ const {
118
+ current
119
+ } = this.parentData
120
+ if (current == index) {
121
+ return error === true ? 'error' : 'process'
122
+ } else if (error) {
123
+ return 'error'
124
+ } else if (current > index) {
125
+ return 'finish'
126
+ } else {
127
+ return 'wait'
128
+ }
129
+ },
130
+ statusColor() {
131
+ let color = ''
132
+ switch (this.statusClass) {
133
+ case 'finish':
134
+ color = this.parentData.activeColor
135
+ break
136
+ case 'error':
137
+ color = uni.$u.color.error
138
+ break
139
+ case 'process':
140
+ color = this.parentData.dot ? this.parentData.activeColor : 'transparent'
141
+ break
142
+ default:
143
+ color = this.parentData.inactiveColor
144
+ break
145
+ }
146
+ return color
147
+ },
148
+ contentStyle() {
149
+ const style = {}
150
+ if (this.parentData.direction === 'column') {
151
+ style.marginLeft = this.parentData.dot ? '2px' : '6px'
152
+ style.marginTop = this.parentData.dot ? '0px' : '6px'
153
+ } else {
154
+ style.marginTop = this.parentData.dot ? '2px' : '6px'
155
+ style.marginLeft = this.parentData.dot ? '2px' : '6px'
156
+ }
157
+
158
+ return style
159
+ }
160
+ },
161
+ mounted() {
162
+ this.parent && this.parent.updateFromChild()
163
+ uni.$u.sleep().then(() => {
164
+ this.getStepsItemRect()
165
+ })
166
+ },
167
+ methods: {
168
+ init() {
169
+ // 初始化数据
170
+ this.updateParentData()
171
+ if (!this.parent) {
172
+ return uni.$u.error('u-steps-item必须要搭配u-steps组件使用')
173
+ }
174
+ this.index = this.parent.children.indexOf(this)
175
+ this.childLength = this.parent.children.length
176
+ },
177
+ updateParentData() {
178
+ // 此方法在mixin中
179
+ this.getParentData('u-steps')
180
+ },
181
+ // 父组件数据发生变化
182
+ updateFromParent() {
183
+ this.init()
184
+ },
185
+ // 获取组件的尺寸,用于设置横线的位置
186
+ getStepsItemRect() {
187
+ // #ifndef APP-NVUE
188
+ this.$uGetRect('.u-steps-item').then(size => {
189
+ this.size = size
190
+ })
191
+ // #endif
192
+
193
+ // #ifdef APP-NVUE
194
+ dom.getComponentRect(this.$refs['u-steps-item'], res => {
195
+ const {
196
+ size
197
+ } = res
198
+ this.size = size
199
+ })
200
+ // #endif
201
+ }
202
+ }
203
+ }
204
+ </script>
205
+
206
+ <style lang="scss" scoped>
207
+ @import "../../libs/css/components.scss";
208
+
209
+ .u-steps-item {
210
+ flex: 1;
211
+ @include flex;
212
+
213
+ &--row {
214
+ flex-direction: column;
215
+ align-items: center;
216
+ position: relative;
217
+ }
218
+
219
+ &--column {
220
+ position: relative;
221
+ flex-direction: row;
222
+ justify-content: flex-start;
223
+ padding-bottom: 5px;
224
+ }
225
+
226
+ &__wrapper {
227
+ @include flex;
228
+ justify-content: center;
229
+ align-items: center;
230
+ position: relative;
231
+ background-color: #fff;
232
+
233
+ &--column {
234
+ width: 20px;
235
+ height: 32px;
236
+
237
+ &--dot {
238
+ height: 20px;
239
+ width: 20px;
240
+ }
241
+ }
242
+
243
+ &--row {
244
+ width: 32px;
245
+ height: 20px;
246
+
247
+ &--dot {
248
+ width: 20px;
249
+ height: 20px;
250
+ }
251
+ }
252
+
253
+ &__circle {
254
+ width: 20px;
255
+ height: 20px;
256
+ /* #ifndef APP-NVUE */
257
+ box-sizing: border-box;
258
+ flex-shrink: 0;
259
+ /* #endif */
260
+ border-radius: 100px;
261
+ border-width: 1px;
262
+ border-color: $u-tips-color;
263
+ border-style: solid;
264
+ @include flex(row);
265
+ align-items: center;
266
+ justify-content: center;
267
+ transition: background-color 0.3s;
268
+
269
+ &__text {
270
+ color: $u-tips-color;
271
+ font-size: 11px;
272
+ @include flex(row);
273
+ align-items: center;
274
+ justify-content: center;
275
+ text-align: center;
276
+ line-height: 11px;
277
+ }
278
+ }
279
+
280
+ &__dot {
281
+ width: 10px;
282
+ height: 10px;
283
+ border-radius: 100px;
284
+ background-color: $u-content-color;
285
+ }
286
+ }
287
+
288
+ &__content {
289
+ @include flex;
290
+ flex: 1;
291
+
292
+ &--row {
293
+ flex-direction: column;
294
+ align-items: center;
295
+ }
296
+
297
+ &--column {
298
+ flex-direction: column;
299
+ margin-left: 6px;
300
+ }
301
+ }
302
+
303
+ &__line {
304
+ position: absolute;
305
+ background: $u-tips-color;
306
+
307
+ &--row {
308
+ top: 10px;
309
+ height: 1px;
310
+ }
311
+
312
+ &--column {
313
+ width: 1px;
314
+ left: 10px;
315
+ }
316
+ }
317
+ }
318
+ </style>