uview-plus 3.1.52 → 3.2.5

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 (134) hide show
  1. package/changelog.md +51 -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 +29 -17
  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-number-box/u-number-box.vue +4 -4
  24. package/components/u-picker/u-picker.vue +5 -2
  25. package/components/u-popup/u-popup.vue +1 -1
  26. package/components/u-radio/u-radio.vue +2 -2
  27. package/components/u-rate/u-rate.vue +1 -1
  28. package/components/u-read-more/u-read-more.vue +164 -160
  29. package/components/u-slider/u-slider.vue +6 -6
  30. package/components/u-steps-item/u-steps-item.vue +318 -318
  31. package/components/u-subsection/u-subsection.vue +35 -21
  32. package/components/u-swiper/u-swiper.vue +6 -8
  33. package/components/u-switch/u-switch.vue +1 -1
  34. package/components/u-tabbar-item/u-tabbar-item.vue +1 -1
  35. package/components/u-tabs/u-tabs.vue +1 -0
  36. package/components/u-tag/props.js +5 -2
  37. package/components/u-tag/u-tag.vue +1 -1
  38. package/components/u-text/u-text.vue +226 -226
  39. package/components/u-textarea/u-textarea.vue +275 -275
  40. package/components/u-transition/u-transition.vue +1 -1
  41. package/components/u-waterfall/u-waterfall.vue +225 -0
  42. package/index.js +5 -2
  43. package/libs/config/props/formItem.js +1 -0
  44. package/libs/config/props/tag.js +30 -29
  45. package/libs/css/common.scss +4 -1
  46. package/libs/css/components.scss +5 -5
  47. package/libs/css/flex.scss +45 -45
  48. package/libs/mixin/mixin.js +2 -2
  49. package/libs/mixin/mpShare.js +15 -13
  50. package/package.json +1 -1
  51. package/types/comps/_common.d.ts +9 -0
  52. package/types/comps/actionSheet.d.ts +121 -0
  53. package/types/comps/album.d.ts +72 -0
  54. package/types/comps/alert.d.ts +55 -0
  55. package/types/comps/avatar.d.ts +85 -0
  56. package/types/comps/avatarGroup.d.ts +62 -0
  57. package/types/comps/backTop.d.ts +74 -0
  58. package/types/comps/badge.d.ts +76 -0
  59. package/types/comps/button.d.ts +169 -0
  60. package/types/comps/calendar.d.ts +164 -0
  61. package/types/comps/cell.d.ts +133 -0
  62. package/types/comps/cellGroup.d.ts +27 -0
  63. package/types/comps/checkbox.d.ts +69 -0
  64. package/types/comps/checkboxGroup.d.ts +93 -0
  65. package/types/comps/code.d.ts +69 -0
  66. package/types/comps/codeInput.d.ts +98 -0
  67. package/types/comps/col.d.ts +43 -0
  68. package/types/comps/collapse.d.ts +52 -0
  69. package/types/comps/collapseItem.d.ts +83 -0
  70. package/types/comps/countDown.d.ts +60 -0
  71. package/types/comps/countTo.d.ts +88 -0
  72. package/types/comps/datetimePicker.d.ts +146 -0
  73. package/types/comps/divider.d.ts +58 -0
  74. package/types/comps/empty.d.ts +72 -0
  75. package/types/comps/form.d.ts +76 -0
  76. package/types/comps/formItem.d.ts +68 -0
  77. package/types/comps/gap.d.ts +35 -0
  78. package/types/comps/grid.d.ts +34 -0
  79. package/types/comps/gridItem.d.ts +28 -0
  80. package/types/comps/icon.d.ts +93 -0
  81. package/types/comps/image.d.ts +119 -0
  82. package/types/comps/indexAnchor.d.ts +38 -0
  83. package/types/comps/indexItem.d.ts +18 -0
  84. package/types/comps/indexList.d.ts +39 -0
  85. package/types/comps/input.d.ts +234 -0
  86. package/types/comps/keyboard.d.ts +125 -0
  87. package/types/comps/line.d.ts +44 -0
  88. package/types/comps/lineProgress.d.ts +51 -0
  89. package/types/comps/link.d.ts +51 -0
  90. package/types/comps/list.d.ts +92 -0
  91. package/types/comps/listItem.d.ts +18 -0
  92. package/types/comps/loadMore.d.ts +108 -0
  93. package/types/comps/loadingIcon.d.ts +68 -0
  94. package/types/comps/loadingPage.d.ts +58 -0
  95. package/types/comps/modal.d.ts +115 -0
  96. package/types/comps/navbar.d.ts +113 -0
  97. package/types/comps/noNetwork.d.ts +40 -0
  98. package/types/comps/noticeBar.d.ts +85 -0
  99. package/types/comps/notify.d.ts +73 -0
  100. package/types/comps/numberBox.d.ts +155 -0
  101. package/types/comps/overlay.d.ts +46 -0
  102. package/types/comps/parse.d.ts +101 -0
  103. package/types/comps/picker.d.ts +115 -0
  104. package/types/comps/popup.d.ts +103 -0
  105. package/types/comps/radio.d.ts +77 -0
  106. package/types/comps/radioGroup.d.ts +97 -0
  107. package/types/comps/rate.d.ts +85 -0
  108. package/types/comps/readMore.d.ts +80 -0
  109. package/types/comps/row.d.ts +34 -0
  110. package/types/comps/scrollList.d.ts +51 -0
  111. package/types/comps/search.d.ts +167 -0
  112. package/types/comps/skeleton.d.ts +70 -0
  113. package/types/comps/slider.d.ts +79 -0
  114. package/types/comps/steps.d.ts +48 -0
  115. package/types/comps/stepsItem.d.ts +41 -0
  116. package/types/comps/sticky.d.ts +48 -0
  117. package/types/comps/subsection.d.ts +64 -0
  118. package/types/comps/swipeAction.d.ts +24 -0
  119. package/types/comps/swipeActionItem.d.ts +58 -0
  120. package/types/comps/swiper.d.ts +142 -0
  121. package/types/comps/swiperIndicator.d.ts +37 -0
  122. package/types/comps/switch.d.ts +73 -0
  123. package/types/comps/tabbar.d.ts +54 -0
  124. package/types/comps/tabbarItem.d.ts +52 -0
  125. package/types/comps/tabs.d.ts +85 -0
  126. package/types/comps/tag.d.ts +93 -0
  127. package/types/comps/text.d.ts +110 -0
  128. package/types/comps/textarea.d.ts +158 -0
  129. package/types/comps/toast.d.ts +59 -0
  130. package/types/comps/tooltip.d.ts +71 -0
  131. package/types/comps/transition.d.ts +61 -0
  132. package/types/comps/upload.d.ts +163 -0
  133. package/types/comps.d.ts +99 -0
  134. package/types/index.d.ts +47 -0
@@ -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>