@cloudbase/weda-ui-mp 3.30.0 → 3.30.1

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.
@@ -4,6 +4,7 @@
4
4
  "usingComponents": {
5
5
  "mp-cells": "weui-miniprogram/cells/cells",
6
6
  "mp-cell": "weui-miniprogram/cell/cell",
7
- "mp-actionSheet": "weui-miniprogram/actionsheet/actionsheet"
7
+ "mp-actionSheet": "weui-miniprogram/actionsheet/actionsheet",
8
+ "wd-button": "../../wd-button/index"
8
9
  }
9
10
  }
@@ -6,8 +6,7 @@
6
6
  {{label}}
7
7
  </view>
8
8
  <view class="weda-uploader-files__btn-contain">
9
- <button class="weui-btn weda-uploader-files__btn" bindtap="onButtonTap" disabled="{{disabled}}">{{uploadButtonText}}</button>
10
-
9
+ <wd-button size="sm" disabled="{{disabled}}" variant="outline" text="{{uploadButtonText}}" bindtap="onButtonTap"> </wd-button>
11
10
  <view wx:if="{{maxCount!=1}}" class="weda-uploader-files__tips">{{uploadTipText}}</view>
12
11
  <view wx:else>
13
12
  <slot name="tips"></slot>
@@ -105,6 +105,10 @@ Component({
105
105
  },
106
106
  min: {},
107
107
  max: {},
108
+ inputValue: {
109
+ type: Number,
110
+ value: null,
111
+ },
108
112
  },
109
113
  data: {
110
114
  isInit: true,
@@ -181,21 +185,20 @@ Component({
181
185
  const toReal = getRealValue({ value: toShow, format });
182
186
  const detail = { ...e.detail, value: toReal };
183
187
 
184
- if (needSetData) {
185
- this.changeForm(detail);
186
- this.triggerEvent('change', detail);
187
- } else {
188
- this.triggerEvent('input', detail);
189
- }
190
-
191
188
  const upDownState = this.getStepDisabled(null, toReal);
192
189
 
193
- needSetData &&
190
+ // 先更新 realValue,避免 value 观察者触发时 realValue 还是旧值导致重复处理
191
+ if (needSetData) {
194
192
  this.setData({
195
193
  realValue: toReal,
196
194
  showValue: toShow,
197
195
  ...upDownState,
198
196
  });
197
+ this.changeForm(detail);
198
+ this.triggerEvent('change', detail);
199
+ } else {
200
+ this.triggerEvent('input', detail);
201
+ }
199
202
 
200
203
  return toReal;
201
204
  },
@@ -288,7 +291,7 @@ Component({
288
291
  ...{ ...this.properties, ...props },
289
292
  type: format,
290
293
  });
291
- const toReal = getRealValue({ value: toShow });
294
+ const toReal = getRealValue({ value: toShow, format });
292
295
 
293
296
  const { stepPlusDisabled, stepMinusDisabled } = this.getStepDisabled(
294
297
  { readOnly, disabled, status, max, min, format },
@@ -447,24 +450,17 @@ Component({
447
450
  },
448
451
  // 监听非输入引起的value变化,比如调用 setValue, clearValue
449
452
  value: function (value) {
453
+ if (equal(value, this.data.realValue)) return;
450
454
  const { format } = this.properties;
451
455
 
452
- let toReal = this.data.realValue;
453
- let toShow = this.data.showValue;
456
+ // value 是真实值,不需要做百分比转换,只需要格式化显示
457
+ const toReal = isNumber(value) ? value : null;
454
458
 
455
- if (!this.data.isInit) {
456
- toReal = isNumber(value) ? value : null;
457
- toShow = this.getShowValue({
458
- ...this.properties,
459
- value: `${isNumber(value) ? value : ''}`,
460
- type: format,
461
- });
462
- }
463
-
464
- // 初始化时同步真实值到表单
465
- if (isNumber(toReal) && this.data.isInit) {
466
- this.changeForm({ value: toReal });
467
- }
459
+ const toShow = this.getShowValue({
460
+ ...this.properties,
461
+ value: `${isNumber(value) ? value : ''}`,
462
+ type: format,
463
+ });
468
464
 
469
465
  const readValue = `${toShow}${getPercentUnit(format)}`;
470
466
 
@@ -482,22 +478,6 @@ Component({
482
478
  });
483
479
  }, 0);
484
480
  },
485
- inputValue: function (inputValue) {
486
- if (equal(inputValue, this.data._oldInputValue)) return;
487
- const { toReal, toShow, stepPlusDisabled, stepMinusDisabled, readValue } = this.getRealAndShowData({
488
- value: inputValue,
489
- });
490
-
491
- this.setData({
492
- readValue,
493
- realValue: toReal,
494
- showValue: this.data.readOnly ? readValue : toShow,
495
- stepPlusDisabled,
496
- stepMinusDisabled,
497
- });
498
- this.changeForm({ value: toReal });
499
- this.data._oldInputValue = inputValue;
500
- },
501
481
  },
502
482
  lifetimes: {
503
483
  attached: function () {
@@ -53,4 +53,5 @@
53
53
  readOnly="{{readOnly}}"
54
54
  value="{{value}}"
55
55
  cursorSpacing="{{cursorSpacing}}"
56
+ type="number"
56
57
  ></inner-input>
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "miniprogram": "./",
4
4
  "packageManager": "yarn@3.0.2",
5
5
  "dependencies": {},
6
- "version": "3.30.0",
6
+ "version": "3.30.1",
7
7
  "main": "./",
8
8
  "publishConfig": {
9
9
  "access": "public"