@10yun/cv-mobile-ui 0.5.61 → 0.5.63

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 (83) hide show
  1. package/package.json +1 -1
  2. package/plugins/uni-extend.js +109 -0
  3. package/ui-cv/components/cv-dialog-bottom/cv-dialog-bottom.vue +71 -47
  4. package/ui-cv/components/cv-dialog-full/cv-dialog-full.vue +20 -17
  5. package/ui-cv/components/cv-upload-avatar/cv-upload-avatar.vue +0 -1
  6. package/ui-cv/components/cv-upload-image/cv-upload-image.vue +0 -1
  7. package/ui-fireui/components/u-action-sheet/u-action-sheet.vue +46 -16
  8. package/ui-fireui/components/u-alert/u-alert.vue +11 -5
  9. package/ui-fireui/components/u-badge/u-badge.vue +52 -69
  10. package/ui-fireui/components/u-bottom-navigation/u-bottom-navigation.vue +28 -20
  11. package/ui-fireui/components/u-bottom-popup/u-bottom-popup.vue +40 -11
  12. package/ui-fireui/components/u-bubble-popup/u-bubble-popup.vue +3 -6
  13. package/ui-fireui/components/u-button/u-button.vue +262 -259
  14. package/ui-fireui/components/u-calendar/u-calendar.vue +227 -44
  15. package/ui-fireui/components/u-calendar/u-calendar2.js +562 -0
  16. package/ui-fireui/components/u-card/u-card.vue +50 -32
  17. package/ui-fireui/components/u-cascade-selection/u-cascade-selection.vue +197 -74
  18. package/ui-fireui/components/u-circular-progress/u-circular-progress.vue +324 -0
  19. package/ui-fireui/components/u-clipboard2/tui-clipboard.js +53 -0
  20. package/ui-fireui/components/u-collapse/u-collapse.vue +8 -8
  21. package/ui-fireui/components/u-config/index.js +129 -0
  22. package/ui-fireui/components/u-count-down/u-count-down.vue +124 -19
  23. package/ui-fireui/components/u-datetime/u-datetime.vue +416 -176
  24. package/ui-fireui/components/u-divider/u-divider.vue +3 -3
  25. package/ui-fireui/components/u-drawer/u-drawer.vue +55 -12
  26. package/ui-fireui/components/u-dropdown-list/u-dropdown-list.vue +103 -0
  27. package/ui-fireui/components/u-fab/u-fab.vue +344 -0
  28. package/ui-fireui/components/u-footer/u-footer.vue +148 -0
  29. package/ui-fireui/components/u-grid/u-grid.vue +2 -8
  30. package/ui-fireui/components/u-grid-item/u-grid-item.vue +22 -5
  31. package/ui-fireui/components/u-icon/u-icon-new.js +190 -0
  32. package/ui-fireui/components/u-icon/u-icon-new.vue +100 -0
  33. package/ui-fireui/components/u-image-cropper/u-image-cropper.vue +1144 -0
  34. package/ui-fireui/components/u-image-group/u-image-group.vue +164 -0
  35. package/ui-fireui/components/u-keyboard/u-keyboard.vue +3 -2
  36. package/ui-fireui/components/u-keyboard-input/u-keyboard-input.vue +1 -1
  37. package/ui-fireui/components/u-list-cell/u-list-cell.vue +82 -72
  38. package/ui-fireui/components/u-list-view/u-list-view.vue +33 -8
  39. package/ui-fireui/components/u-loading/u-loading.vue +107 -27
  40. package/ui-fireui/components/u-loadmore/u-loadmore.vue +21 -3
  41. package/ui-fireui/components/u-modal/u-modal.vue +140 -176
  42. package/ui-fireui/components/u-navigation-bar/u-navigation-bar.vue +121 -28
  43. package/ui-fireui/components/u-no-data/u-no-data.vue +58 -20
  44. package/ui-fireui/components/u-nomore/u-nomore.vue +5 -4
  45. package/ui-fireui/components/u-numberbox/u-numberbox.vue +88 -45
  46. package/ui-fireui/components/u-picture-cropper/u-picture-cropper.vue +94 -36
  47. package/ui-fireui/components/u-picture-cropper/u-picture-cropper.wxs +27 -17
  48. package/ui-fireui/components/u-rate/u-rate.vue +197 -0
  49. package/ui-fireui/components/u-round-progress/u-round-progress.vue +62 -42
  50. package/ui-fireui/components/u-scroll-top/u-scroll-top.vue +4 -3
  51. package/ui-fireui/components/u-section/u-section.vue +149 -0
  52. package/ui-fireui/components/u-skeleton/u-skeleton.vue +37 -6
  53. package/ui-fireui/components/u-steps/u-steps.vue +110 -27
  54. package/ui-fireui/components/u-sticky/u-sticky.vue +35 -21
  55. package/ui-fireui/components/u-sticky-wxs/u-sticky-wxs.vue +7 -4
  56. package/ui-fireui/components/u-sticky-wxs/u-sticky.wxs +39 -36
  57. package/ui-fireui/components/u-swipe-action/u-swipe-action.vue +76 -19
  58. package/ui-fireui/components/u-tabbar/u-tabbar.vue +71 -38
  59. package/ui-fireui/components/u-tabs/u-tabs.vue +133 -51
  60. package/ui-fireui/components/u-tag/u-tag.vue +109 -226
  61. package/ui-fireui/components/u-time-axis/u-time-axis.vue +1 -1
  62. package/ui-fireui/components/u-timeaxis-item/u-timeaxis-item.vue +1 -1
  63. package/ui-fireui/components/u-tips/u-tips.vue +35 -15
  64. package/ui-fireui/components/u-toast/u-toast.vue +9 -5
  65. package/ui-fireui/components/u-top-dropdown/u-top-dropdown.vue +8 -6
  66. package/ui-fireui/components/u-upload/u-upload-old.vue +462 -0
  67. package/ui-fireui/components/u-upload/u-upload.vue +648 -446
  68. package/ui-fireui/components/u-white-space/u-white-space.vue +68 -0
  69. package/ui-fireui/components/u-wing-blank/u-wing-blank.vue +100 -0
  70. package/uview-plus/changelog-v2.md +77 -6
  71. package/uview-plus/changelog-wu.md +41 -14
  72. package/uview-plus/changelog.md +375 -59
  73. package/uview-plus/libs/ctocode/index.js +1 -0
  74. package/{plugins/uni-richText.js → uview-plus/libs/ctocode/richText.js} +28 -32
  75. package/uview-plus/package-wu.json +5 -37
  76. package/uview-plus/package.json +13 -14
  77. package/plugins/tui-validation.js +0 -279
  78. package/plugins/uni-scanCode.js +0 -76
  79. package/plugins/uni-socket.js +0 -174
  80. package/plugins/uniMap.js +0 -48
  81. package/plugins/utils.js +0 -13
  82. package/uview-plus/changelog-wu-tool.md +0 -21
  83. package/uview-plus/package-wu-tool.json +0 -84
@@ -1,24 +1,38 @@
1
1
  <template>
2
2
  <view
3
3
  class="up-navigation-bar"
4
- :class="{ 'up-bar-line': opcity > 0.85 && splitLine, 'up-navbar-fixed': isFixed }"
5
- :style="{ height: height + 'px', backgroundColor: `rgba(${backgroundColor},${opcity})` }"
4
+ :class="{
5
+ 'up-bar-line': opacity > 0.85 && splitLine,
6
+ 'up-navbar-fixed': isFixed,
7
+ 'up-backdrop__filter': backdropFilter && dropDownOpacity > 0
8
+ }"
9
+ :style="{
10
+ height: height + 'px',
11
+ background: isOpacity ? `rgba(${background},${opacity})` : background,
12
+ opacity: dropDownOpacity,
13
+ zIndex: isFixed ? zIndex : 'auto'
14
+ }"
6
15
  >
7
16
  <view class="up-status-bar" :style="{ height: statusBarHeight + 'px' }" v-if="isImmersive"></view>
8
17
  <view
9
18
  class="up-navigation_bar-title"
10
- :style="{ opacity: opcity, color: color, paddingTop: top - statusBarHeight + 'px' }"
19
+ :style="{
20
+ opacity: transparent || opacity >= maxOpacity ? 1 : opacity,
21
+ color: color,
22
+ paddingTop: top - statusBarHeight + 'px'
23
+ }"
11
24
  v-if="title && !isCustom"
12
25
  >
13
26
  {{ title }}
14
27
  </view>
15
- <slot />
28
+ <slot></slot>
16
29
  </view>
17
30
  </template>
18
31
 
19
32
  <script>
20
33
  export default {
21
- name: 'fuiNavigationBar',
34
+ name: 'tuiNavigationBar',
35
+ emits: ['init', 'change'],
22
36
  props: {
23
37
  //NavigationBar标题
24
38
  title: {
@@ -28,12 +42,12 @@ export default {
28
42
  //NavigationBar标题颜色
29
43
  color: {
30
44
  type: String,
31
- default: '#fff'
45
+ default: '#333'
32
46
  },
33
- //NavigationBar背景颜色 rgb
47
+ //NavigationBar背景颜色,不支持rgb
34
48
  backgroundColor: {
35
49
  type: String,
36
- default: '86,119,252'
50
+ default: '#fff'
37
51
  },
38
52
  //是否需要分割线
39
53
  splitLine: {
@@ -41,19 +55,29 @@ export default {
41
55
  default: false
42
56
  },
43
57
  //是否设置不透明度
44
- isOpcity: {
58
+ isOpacity: {
45
59
  type: Boolean,
46
60
  default: true
47
61
  },
62
+ //不透明度最大值 0-1
63
+ maxOpacity: {
64
+ type: [Number, String],
65
+ default: 1
66
+ },
67
+ //背景透明 【设置该属性,则背景透明,只出现内容,isOpacity和maxOpacity失效】
68
+ transparent: {
69
+ type: Boolean,
70
+ default: false
71
+ },
48
72
  //滚动条滚动距离
49
73
  scrollTop: {
50
74
  type: [Number, String],
51
75
  default: 0
52
76
  },
53
77
  /*
54
- isOpcity 为true时生效
55
- opcity=scrollTop /windowWidth * scrollRatio
56
- */
78
+ isOpacity 为true时生效
79
+ opacity=scrollTop /windowWidth * scrollRatio
80
+ */
57
81
  scrollRatio: {
58
82
  type: [Number, String],
59
83
  default: 0.3
@@ -71,12 +95,36 @@ export default {
71
95
  isFixed: {
72
96
  type: Boolean,
73
97
  default: true
98
+ },
99
+ //是否开启高斯模糊效果[仅在支持的浏览器有效果]
100
+ backdropFilter: {
101
+ type: Boolean,
102
+ default: false
103
+ },
104
+ //下拉隐藏NavigationBar,主要针对有回弹效果ios端
105
+ dropDownHide: {
106
+ type: Boolean,
107
+ default: false
108
+ },
109
+ //z-index设置
110
+ zIndex: {
111
+ type: [Number, String],
112
+ default: 996
74
113
  }
75
114
  },
76
115
  watch: {
77
116
  scrollTop(newValue, oldValue) {
78
- if (this.isOpcity) {
79
- this.opcityChange();
117
+ if (this.isOpacity && !this.transparent) {
118
+ this.opacityChange();
119
+ }
120
+ },
121
+ backgroundColor(val) {
122
+ if (val) {
123
+ if (this.isOpacity) {
124
+ this.background = this.hexToRgb(val);
125
+ } else {
126
+ this.background = this.transparent ? 'rgba(0, 0, 0, 0)' : val;
127
+ }
80
128
  }
81
129
  }
82
130
  },
@@ -86,13 +134,21 @@ export default {
86
134
  left: 375, //小程序端 左侧距胶囊按钮距离
87
135
  height: 44, //header高度
88
136
  top: 0,
89
- scrollH: 1,//0 //滚动总高度,计算opcity
90
- opcity: 0, //0-1
91
- statusBarHeight: 0 //状态栏高度
137
+ scrollH: 1, //滚动总高度,计算opacity
138
+ opacity: 1, //0-1
139
+ statusBarHeight: 0, //状态栏高度
140
+ background: '255,255,255', //header背景色
141
+ dropDownOpacity: 1
92
142
  };
93
143
  },
94
144
  created() {
95
- this.opcity = this.isOpcity ? this.opcity : 1;
145
+ this.dropDownOpacity = this.backdropFilter && 0;
146
+ this.opacity = this.isOpacity || this.transparent ? 0 : this.maxOpacity;
147
+ if (this.isOpacity) {
148
+ this.background = this.hexToRgb(this.backgroundColor);
149
+ } else {
150
+ this.background = this.transparent ? 'rgba(0, 0, 0, 0)' : this.backgroundColor;
151
+ }
96
152
  let obj = {};
97
153
  // #ifdef MP-WEIXIN
98
154
  obj = wx.getMenuButtonBoundingClientRect();
@@ -103,7 +159,6 @@ export default {
103
159
  // #ifdef MP-ALIPAY
104
160
  my.hideAddToDesktopMenu();
105
161
  // #endif
106
-
107
162
  uni.getSystemInfo({
108
163
  success: (res) => {
109
164
  this.statusBarHeight = res.statusBarHeight;
@@ -117,25 +172,52 @@ export default {
117
172
  this.$emit('init', {
118
173
  width: this.width,
119
174
  height: this.height,
120
- left: obj.left,
175
+ left: this.left,
121
176
  top: this.top,
122
177
  statusBarHeight: this.statusBarHeight,
123
- opcity: this.opcity
178
+ opacity: this.opacity,
179
+ windowHeight: res.windowHeight
124
180
  });
125
181
  }
126
182
  });
127
183
  },
128
184
  methods: {
129
- opcityChange() {
185
+ hexToRgb(hex) {
186
+ let rgb = '255,255,255';
187
+ if (hex && ~hex.indexOf('#')) {
188
+ if (hex.length === 4) {
189
+ let text = hex.substring(1, 4);
190
+ hex = '#' + text + text;
191
+ }
192
+ let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
193
+ if (result) {
194
+ rgb = `${parseInt(result[1], 16)},${parseInt(result[2], 16)},${parseInt(result[3], 16)}`;
195
+ }
196
+ }
197
+ return rgb;
198
+ },
199
+ opacityChange() {
200
+ if (this.dropDownHide) {
201
+ if (this.scrollTop < 0) {
202
+ if (this.dropDownOpacity > 0) {
203
+ this.dropDownOpacity = 1 - Math.abs(this.scrollTop) / 30;
204
+ }
205
+ } else {
206
+ this.dropDownOpacity = 1;
207
+ }
208
+ }
209
+
130
210
  let scroll = this.scrollTop <= 1 ? 0 : this.scrollTop;
131
- // let scroll = this.scrollTop <= 0 ? 0 : this.scrollTop;
132
- let opcity = scroll / this.scrollH;
133
- if ((this.opcity >= 1 && opcity >= 1) || (this.opcity == 0 && opcity == 0)) {
211
+ let opacity = scroll / this.scrollH;
212
+ if ((this.opacity >= this.maxOpacity && opacity >= this.maxOpacity) || (this.opacity == 0 && opacity == 0)) {
134
213
  return;
135
214
  }
136
- this.opcity = opcity;
215
+ this.opacity = opacity > this.maxOpacity ? this.maxOpacity : opacity;
216
+ if (this.backdropFilter) {
217
+ this.dropDownOpacity = this.opacity >= this.maxOpacity ? 1 : this.opacity;
218
+ }
137
219
  this.$emit('change', {
138
- opcity: this.opcity
220
+ opacity: this.opacity
139
221
  });
140
222
  }
141
223
  }
@@ -145,16 +227,27 @@ export default {
145
227
  <style scoped>
146
228
  .up-navigation-bar {
147
229
  width: 100%;
230
+ transition: opacity 0.4s;
231
+ }
232
+
233
+ .up-backdrop__filter {
234
+ /* Safari for macOS & iOS */
235
+ -webkit-backdrop-filter: blur(15px);
236
+ /* Google Chrome */
237
+ backdrop-filter: blur(15px);
148
238
  }
239
+
149
240
  .up-navbar-fixed {
150
241
  position: fixed;
151
242
  left: 0;
152
243
  top: 0;
153
- z-index: 9998;
244
+ transform: translateZ(0);
154
245
  }
246
+
155
247
  .up-status-bar {
156
248
  width: 100%;
157
249
  }
250
+
158
251
  .up-navigation_bar-title {
159
252
  width: 100%;
160
253
  font-size: 17px;
@@ -1,29 +1,36 @@
1
1
  <template>
2
- <view class="up-nodata-box" :class="[fixed ? 'up-nodata-fixed' : '']">
2
+ <view class="up-nodata-box" :class="[fixed ? 'up-nodata-fixed' : '']" :style="{ marginTop: marginTop + 'rpx' }">
3
3
  <image
4
4
  v-if="imgUrl"
5
5
  :src="imgUrl"
6
6
  class="up-tips-icon"
7
- :style="{ width: imgWidth + 'rpx', height: imgHeight + 'rpx' }"
7
+ :style="{ width: imgWidth + 'rpx', height: imgHeight + 'rpx', marginBottom: imgBottom + 'rpx' }"
8
+ mode="widthFix"
8
9
  ></image>
9
10
  <view class="up-tips-content">
10
11
  <slot></slot>
11
12
  </view>
12
- <button
13
+ <view
13
14
  class="up-tips-btn"
14
- hover-class="up-tips-btn-hover"
15
- :style="{ width: btnWidth + 'rpx' }"
15
+ :style="{
16
+ width: btnWidth + 'rpx',
17
+ height: btnHeight + 'rpx',
18
+ background: getBgColor,
19
+ borderRadius: radius,
20
+ fontSize: size + 'rpx'
21
+ }"
16
22
  v-if="btnText"
17
23
  @tap="handleClick"
18
24
  >
19
25
  {{ btnText }}
20
- </button>
26
+ </view>
21
27
  </view>
22
28
  </template>
23
29
 
24
30
  <script>
25
31
  export default {
26
- name: 'fuiNoData',
32
+ name: 'tuiNoData',
33
+ emits: ['click'],
27
34
  props: {
28
35
  //是否垂直居中
29
36
  fixed: {
@@ -37,23 +44,55 @@ export default {
37
44
  },
38
45
  //图片宽度
39
46
  imgWidth: {
40
- type: Number,
47
+ type: [Number, String],
41
48
  default: 200
42
49
  },
43
50
  //图片高度
44
51
  imgHeight: {
45
- type: Number,
52
+ type: [Number, String],
46
53
  default: 200
47
54
  },
55
+ //V2.3.0+
56
+ imgBottom: {
57
+ type: [Number, String],
58
+ default: 30
59
+ },
48
60
  //按钮宽度
49
61
  btnWidth: {
50
- type: Number,
62
+ type: [Number, String],
51
63
  default: 200
52
64
  },
65
+ btnHeight: {
66
+ type: [Number, String],
67
+ default: 60
68
+ },
53
69
  //按钮文字,没有则不显示
54
70
  btnText: {
55
71
  type: String,
56
72
  default: ''
73
+ },
74
+ //按钮背景色
75
+ backgroundColor: {
76
+ type: String,
77
+ default: ''
78
+ },
79
+ size: {
80
+ type: [Number, String],
81
+ default: 28
82
+ },
83
+ radius: {
84
+ type: String,
85
+ default: '8rpx'
86
+ },
87
+ //2.3.0+
88
+ marginTop: {
89
+ type: [Number, String],
90
+ default: 0
91
+ }
92
+ },
93
+ computed: {
94
+ getBgColor() {
95
+ return this.backgroundColor || (uni && uni.$tui && uni.$tui.color.danger) || '#EB0909';
57
96
  }
58
97
  },
59
98
  methods: {
@@ -86,31 +125,30 @@ export default {
86
125
  flex-shrink: 0;
87
126
  width: 280rpx;
88
127
  height: 280rpx;
89
- margin-bottom: 40rpx;
90
128
  }
91
129
 
92
130
  .up-tips-content {
93
131
  text-align: center;
94
132
  color: #666666;
95
133
  font-size: 28rpx;
96
- padding: 0 50rpx 24rpx 50rpx;
134
+ padding: 0 50rpx 28rpx 50rpx;
97
135
  box-sizing: border-box;
98
136
  word-break: break-all;
99
137
  word-wrap: break-word;
100
138
  }
101
139
 
102
140
  .up-tips-btn {
103
- height: 60rpx;
104
- line-height: 60rpx;
105
- font-size: 28rpx;
106
- background-color: #eb0909;
107
141
  color: #fff;
108
- border-radius: 6rpx;
109
142
  margin: 0;
143
+ display: flex;
144
+ align-items: center;
145
+ justify-content: center;
146
+ /* #ifdef H5 */
147
+ cursor: pointer;
148
+ /* #endif */
110
149
  }
111
150
 
112
- .up-tips-btn-hover {
113
- background-color: #c80808;
114
- color: #e5e5e5;
151
+ .up-tips-btn:active {
152
+ opacity: 0.5;
115
153
  }
116
154
  </style>
@@ -7,9 +7,10 @@
7
7
  </view>
8
8
  </view>
9
9
  </template>
10
+
10
11
  <script>
11
12
  export default {
12
- name: 'fuiNomore',
13
+ name: 'tuiNomore',
13
14
  props: {
14
15
  //当前页面背景颜色
15
16
  backgroundColor: {
@@ -40,7 +41,7 @@ export default {
40
41
  width: 50%;
41
42
  margin: 1.5em auto;
42
43
  line-height: 1.5em;
43
- font-size: 28rpx;
44
+ font-size: 24rpx;
44
45
  display: flex;
45
46
  justify-content: center;
46
47
  }
@@ -58,7 +59,7 @@ export default {
58
59
  .up-nomore::before {
59
60
  content: ' ';
60
61
  position: absolute;
61
- border-bottom: 1rpx solid #333;
62
+ border-bottom: 1rpx solid #e5e5e5;
62
63
  -webkit-transform: scaleY(0.5);
63
64
  transform: scaleY(0.5);
64
65
  width: 100%;
@@ -68,7 +69,7 @@ export default {
68
69
 
69
70
  .up-nomore-text {
70
71
  color: #999;
71
- font-size: 28rpx;
72
+ font-size: 24rpx;
72
73
  text-align: center;
73
74
  padding: 0 18rpx;
74
75
  height: 36rpx;
@@ -1,11 +1,16 @@
1
1
  <template>
2
2
  <view class="up-numberbox">
3
3
  <view
4
- class="up-numbox-icon up-icon-reduce"
5
- :class="[disabled || min >= value ? 'up-disabled' : '']"
4
+ class="up-num__icon__box"
5
+ :style="{ background: iconBgColor, borderRadius: radius }"
6
6
  @tap="reduce"
7
- :style="{ color: iconColor, fontSize: iconSize + 'rpx' }"
8
- ></view>
7
+ :class="[disabled || min >= inputValue ? 'up-disabled' : '']"
8
+ >
9
+ <text
10
+ class="up-numbox-icon up-num__icon-reduce"
11
+ :style="{ color: iconColor, fontSize: iconSize + 'rpx', lineHeight: iconSize + 'rpx' }"
12
+ ></text>
13
+ </view>
9
14
  <input
10
15
  type="number"
11
16
  v-model="inputValue"
@@ -15,27 +20,33 @@
15
20
  :style="{
16
21
  color: color,
17
22
  fontSize: size + 'rpx',
18
- backgroundColor: backgroundColor,
23
+ background: backgroundColor,
19
24
  height: height + 'rpx',
20
25
  minHeight: height + 'rpx',
21
26
  width: width + 'rpx'
22
27
  }"
23
28
  />
24
29
  <view
25
- class="up-numbox-icon up-icon-plus"
26
- :class="[disabled || value >= max ? 'up-disabled' : '']"
30
+ class="up-num__icon__box"
31
+ :style="{ background: iconBgColor, borderRadius: radius }"
27
32
  @tap="plus"
28
- :style="{ color: iconColor, fontSize: iconSize + 'rpx' }"
29
- ></view>
33
+ :class="[disabled || inputValue >= max ? 'up-disabled' : '']"
34
+ >
35
+ <text
36
+ class="up-numbox-icon up-num__icon-plus"
37
+ :style="{ color: iconColor, fontSize: iconSize + 'rpx', lineHeight: iconSize + 'rpx' }"
38
+ ></text>
39
+ </view>
30
40
  </view>
31
41
  </template>
32
42
 
33
43
  <script>
34
44
  export default {
35
- name: 'fuiNumberbox',
45
+ name: 'tuiNumberbox',
46
+ emits: ['change'],
36
47
  props: {
37
48
  value: {
38
- type: Number,
49
+ type: [Number, String],
39
50
  default: 1
40
51
  },
41
52
  //最小值
@@ -58,14 +69,22 @@ export default {
58
69
  type: Boolean,
59
70
  default: false
60
71
  },
72
+ iconBgColor: {
73
+ type: String,
74
+ default: 'transparent'
75
+ },
76
+ radius: {
77
+ type: String,
78
+ default: '50%'
79
+ },
61
80
  //加减图标大小 rpx
62
81
  iconSize: {
63
82
  type: Number,
64
- default: 10
83
+ default: 22
65
84
  },
66
85
  iconColor: {
67
86
  type: String,
68
- default: '#fff'
87
+ default: '#666666'
69
88
  },
70
89
  //input 高度
71
90
  height: {
@@ -84,7 +103,7 @@ export default {
84
103
  //input 背景颜色
85
104
  backgroundColor: {
86
105
  type: String,
87
- default: '#fff'
106
+ default: '#F5F5F5'
88
107
  },
89
108
  //input 字体颜色
90
109
  color: {
@@ -116,47 +135,53 @@ export default {
116
135
  }
117
136
  },
118
137
  methods: {
119
- getScale() {
138
+ getScale(val, step) {
120
139
  let scale = 1;
140
+ let scaleVal = 1;
141
+ //浮点型
142
+ if (!Number.isInteger(step)) {
143
+ scale = Math.pow(10, (step + '').split('.')[1].length);
144
+ }
121
145
  //浮点型
122
- if (!Number.isInteger(this.step)) {
123
- scale = Math.pow(10, (this.step + '').split('.')[1].length);
146
+ if (!Number.isInteger(val)) {
147
+ scaleVal = Math.pow(10, (val + '').split('.')[1].length);
124
148
  }
125
- return scale;
149
+ return Math.max(scale, scaleVal);
126
150
  },
127
- calcNum(type) {
128
- if (this.disabled) {
151
+ calcNum: function (type) {
152
+ if (
153
+ this.disabled ||
154
+ (this.inputValue == this.min && type === 'reduce') ||
155
+ (this.inputValue == this.max && type === 'plus')
156
+ ) {
129
157
  return;
130
158
  }
131
- const scale = this.getScale();
132
- let num = this.value * scale;
159
+ const scale = this.getScale(Number(this.inputValue), Number(this.step));
160
+ let num = Number(this.inputValue) * scale;
133
161
  let step = this.step * scale;
134
162
  if (type === 'reduce') {
135
163
  num -= step;
136
164
  } else if (type === 'plus') {
137
165
  num += step;
138
166
  }
139
- let value = num / scale;
140
- if (type === 'plus' && value < this.min) {
167
+ let value = Number((num / scale).toFixed(String(scale).length - 1));
168
+ if (value < this.min) {
141
169
  value = this.min;
142
- } else if (type === 'reduce' && value > this.max) {
170
+ } else if (value > this.max) {
143
171
  value = this.max;
144
172
  }
145
- if (value < this.min || value > this.max) {
146
- return;
147
- }
148
173
  this.handleChange(value, type);
149
174
  },
150
- plus() {
175
+ plus: function () {
151
176
  this.calcNum('plus');
152
177
  },
153
- reduce() {
178
+ reduce: function () {
154
179
  this.calcNum('reduce');
155
180
  },
156
- blur(e) {
181
+ blur: function (e) {
157
182
  let value = e.detail.value;
158
183
  if (value) {
159
- if (~value.indexOf('.') && Number.isInteger(this.step)) {
184
+ if (~value.indexOf('.') && Number.isInteger(this.step) && Number.isInteger(Number(value))) {
160
185
  value = value.split('.')[0];
161
186
  }
162
187
  value = Number(value);
@@ -176,7 +201,7 @@ export default {
176
201
  handleChange(value, type) {
177
202
  if (this.disabled) return;
178
203
  this.$emit('change', {
179
- value: value,
204
+ value: Number(value),
180
205
  type: type,
181
206
  index: this.index,
182
207
  custom: this.custom
@@ -195,40 +220,58 @@ export default {
195
220
  font-style: normal;
196
221
  }
197
222
 
223
+ .up-num__icon__box {
224
+ display: flex;
225
+ align-items: center;
226
+ justify-content: center;
227
+ text-align: center;
228
+ padding: 12rpx;
229
+ /* #ifdef H5 */
230
+ cursor: pointer;
231
+ /* #endif */
232
+ }
233
+
198
234
  .up-numbox-icon {
199
235
  font-family: 'numberbox' !important;
200
236
  font-style: normal;
201
237
  -webkit-font-smoothing: antialiased;
202
238
  -moz-osx-font-smoothing: grayscale;
203
- padding: 5rpx;
204
- background: #9e9e9e;
205
- border-radius: 100%;
206
- margin: 0 5px;
207
239
  }
208
240
 
209
- .up-icon-reduce:before {
241
+ .up-num__icon-reduce:before {
210
242
  content: '\e691';
211
243
  }
212
244
 
213
- .up-icon-plus:before {
245
+ .up-num__icon-plus:before {
214
246
  content: '\e605';
215
247
  }
216
248
 
217
249
  .up-numberbox {
218
- display: -webkit-inline-flex;
250
+ /* #ifndef APP-NVUE */
219
251
  display: inline-flex;
252
+ /* #endif */
220
253
  align-items: center;
221
254
  }
222
255
 
223
256
  .up-num-input {
224
257
  text-align: center;
225
- background: #ffffff;
226
- border-radius: 3px;
227
- border: 1px solid #d4d4d4;
258
+ margin: 0 6rpx;
259
+ font-weight: 400;
260
+ padding: 0;
261
+ border-width: 0;
262
+ }
263
+ /* #ifdef H5 */
264
+ ::-webkit-inner-spin-button,
265
+ ::-webkit-outer-spin-button {
266
+ -webkit-appearance: none;
267
+ margin: 0;
228
268
  }
269
+ /* #endif */
229
270
 
230
271
  .up-disabled {
231
- color: #ededed !important;
232
- border-color: #ededed !important;
272
+ opacity: 0.5;
273
+ /* #ifdef H5 */
274
+ cursor: not-allowed;
275
+ /* #endif */
233
276
  }
234
277
  </style>