@cloudbase/weda-ui-mp 3.18.8 → 3.20.0

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.
@@ -138,6 +138,10 @@ Component({
138
138
  type: Array,
139
139
  value: [],
140
140
  },
141
+ duration: {
142
+ type: Number,
143
+ value: 2000,
144
+ },
141
145
  },
142
146
  lifetimes: {
143
147
  attached() {
@@ -153,7 +157,7 @@ Component({
153
157
  },
154
158
  clickLotteryButton: function (_, force) {
155
159
  const { lotteryList } = this.data;
156
- const { prizeResult, enablePrize, clickLotteryEnable } = this.properties;
160
+ const { prizeResult, enablePrize, clickLotteryEnable, duration } = this.properties;
157
161
  //触发外部事件
158
162
  this.triggerEvent('clickLotteryButton', {});
159
163
 
@@ -178,10 +182,7 @@ Component({
178
182
  let intervalId = setInterval(() => {
179
183
  //再次获取抽奖结果
180
184
  let prizeResultNew = this.properties.prizeResult;
181
- if (
182
- prizeResultNew == null ||
183
- (!this.properties.enablePrize && !force)
184
- ) {
185
+ if (prizeResultNew == null || (!this.properties.enablePrize && !force)) {
185
186
  //如果是禁止,立马停止
186
187
  clearInterval();
187
188
  this.setData({
@@ -261,7 +262,7 @@ Component({
261
262
  // eslint-disable-next-line rulesdir/no-timer
262
263
  setTimeout(() => {
263
264
  isTimeout = true;
264
- }, 3000);
265
+ }, duration);
265
266
  },
266
267
  },
267
268
  observers: {
@@ -293,7 +294,7 @@ Component({
293
294
  list.map(async (item) => {
294
295
  const src = await getTempFileURL(item.src);
295
296
  return { ...item, src };
296
- })
297
+ }),
297
298
  );
298
299
  this.setData({
299
300
  lotteryList: realList,
@@ -72,9 +72,9 @@ Component({
72
72
  * 用于同步子组件的默认值
73
73
  * @param params
74
74
  */
75
- __setValueImmediate__(params) {
76
- that.changeByChildFormObj(params);
77
- },
75
+ // __setValueImmediate__(params) {
76
+ // that.changeByChildFormObj(params);
77
+ // },
78
78
  /**
79
79
  * 嵌套表单内部子组件值改变时,触发嵌套表单组件的值更新
80
80
  * @param params.name 子组件名称
@@ -269,16 +269,16 @@ Component({
269
269
  parentForm?.updateFormContext();
270
270
  }
271
271
 
272
- if (params.name) {
273
- // 触发父级嵌套表单值更新
274
- parentFormObj?.__setValueImmediate__?.({
275
- name: params.name,
276
- value: params.value,
277
- });
278
- } else if (parentFormObj?.formObjName) {
279
- // 外部直接调用formObj.setValue的情况下,触发父级嵌套表单值更新
280
- parentFormObj?.__setValueImmediate__?.({ name, value });
281
- }
272
+ // if (params.name) {
273
+ // // 触发父级嵌套表单值更新
274
+ // parentFormObj?.__setValueImmediate__?.({
275
+ // name: params.name,
276
+ // value: params.value,
277
+ // });
278
+ // } else if (parentFormObj?.formObjName) {
279
+ // // 外部直接调用formObj.setValue的情况下,触发父级嵌套表单值更新
280
+ // parentFormObj?.__setValueImmediate__?.({ name, value });
281
+ // }
282
282
  },
283
283
  /**
284
284
  * 子组件默认值变更,触发嵌套表单值更新
@@ -286,41 +286,36 @@ Component({
286
286
  * @param params.value
287
287
  */
288
288
  changeByChildFormObj(params) {
289
- const { objValue, name } = this.data;
290
- const value = deepClone(objValue);
291
- lodashSet(value, getValueName(params.name, name), params.value);
292
-
293
- const tempValue = this.getTempValue(value);
294
-
295
- const tempObjValue = this.getTempValue(objValue);
296
- if (equal(tempValue, tempObjValue)) {
297
- return;
298
- }
299
- this.setData({ objValue: value || [] });
300
-
301
- const parentFormObj = this.getParentFormObj();
302
- const parentForm = this.getParentForm();
303
-
304
- if (params.name) {
305
- // 判断是否将当前的name前缀加上,以便父级嵌套表单更新值
306
- const nameTemp = `${!params.name.startsWith(name) && name ? `${name}.` : ''}${params.name}`;
307
- // 将值同步给父级嵌套表单
308
- parentFormObj?.__setValueImmediate__?.({
309
- name: nameTemp,
310
- value: params.value,
311
- });
312
- } else if (parentFormObj?.formObjName) {
313
- // 外部直接调用formObj.setValue的情况下,触发父级嵌套表单值更新
314
- parentFormObj?.__setValueImmediate__?.({ name, value });
315
- }
316
-
317
- if (!parentFormObj && parentForm) {
318
- // 触发父级普通表单值更新
319
- // 子组件向上同步值,不调用setValue
320
- // parentForm?.setValue?.({ [name]: value }, false, true);
321
- // 刷新父级普通表单的formData
322
- parentForm?.updateFormContext();
323
- }
289
+ // const { objValue, name } = this.data;
290
+ // const value = deepClone(objValue);
291
+ // lodashSet(value, getValueName(params.name, name), params.value);
292
+ // const tempValue = this.getTempValue(value);
293
+ // const tempObjValue = this.getTempValue(objValue);
294
+ // if (equal(tempValue, tempObjValue)) {
295
+ // return;
296
+ // }
297
+ // this.setData({ objValue: value || [] });
298
+ // const parentFormObj = this.getParentFormObj();
299
+ // const parentForm = this.getParentForm();
300
+ // if (params.name) {
301
+ // // 判断是否将当前的name前缀加上,以便父级嵌套表单更新值
302
+ // const nameTemp = `${!params.name.startsWith(name) && name ? `${name}.` : ''}${params.name}`;
303
+ // // 将值同步给父级嵌套表单
304
+ // parentFormObj?.__setValueImmediate__?.({
305
+ // name: nameTemp,
306
+ // value: params.value,
307
+ // });
308
+ // } else if (parentFormObj?.formObjName) {
309
+ // // 外部直接调用formObj.setValue的情况下,触发父级嵌套表单值更新
310
+ // parentFormObj?.__setValueImmediate__?.({ name, value });
311
+ // }
312
+ // if (!parentFormObj && parentForm) {
313
+ // // 触发父级普通表单值更新
314
+ // // 子组件向上同步值,不调用setValue
315
+ // // parentForm?.setValue?.({ [name]: value }, false, true);
316
+ // // 刷新父级普通表单的formData
317
+ // parentForm?.updateFormContext();
318
+ // }
324
319
  },
325
320
  },
326
321
  observers: {
@@ -61,9 +61,9 @@ Component({
61
61
  * 用于同步子组件的默认值
62
62
  * @param params
63
63
  */
64
- __setValueImmediate__(params) {
65
- that.changeByChildFormObj(params);
66
- },
64
+ // __setValueImmediate__(params) {
65
+ // that.changeByChildFormObj(params);
66
+ // },
67
67
  /**
68
68
  * 嵌套表单内部子组件值改变时,触发嵌套表单组件的值更新
69
69
  * @param params.name 子组件名称
@@ -213,16 +213,16 @@ Component({
213
213
  parentForm?.updateFormContext();
214
214
  }
215
215
 
216
- if (params.name) {
217
- // 触发父级嵌套表单值更新
218
- parentFormObj?.__setValueImmediate__?.({
219
- name: params.name,
220
- value: params.value,
221
- });
222
- } else if (parentFormObj?.formObjName) {
223
- // 外部直接调用formObj.setValue的情况下,触发父级嵌套表单值更新
224
- parentFormObj?.__setValueImmediate__?.({ name, value });
225
- }
216
+ // if (params.name) {
217
+ // // 触发父级嵌套表单值更新
218
+ // parentFormObj?.__setValueImmediate__?.({
219
+ // name: params.name,
220
+ // value: params.value,
221
+ // });
222
+ // } else if (parentFormObj?.formObjName) {
223
+ // // 外部直接调用formObj.setValue的情况下,触发父级嵌套表单值更新
224
+ // parentFormObj?.__setValueImmediate__?.({ name, value });
225
+ // }
226
226
 
227
227
  this.triggerOnDataChange(value);
228
228
  },
@@ -231,42 +231,42 @@ Component({
231
231
  * @param params.name
232
232
  * @param params.value
233
233
  */
234
- changeByChildFormObj(params) {
235
- const { objValue, name } = this.data;
236
- const value = deepClone(objValue);
237
- lodashSet(value, getValueName(params.name, name), params.value);
234
+ // changeByChildFormObj(params) {
235
+ // const { objValue, name } = this.data;
236
+ // const value = deepClone(objValue);
237
+ // lodashSet(value, getValueName(params.name, name), params.value);
238
238
 
239
- if (equal(value, objValue)) {
240
- return;
241
- }
239
+ // if (equal(value, objValue)) {
240
+ // return;
241
+ // }
242
242
 
243
- const parentFormObj = this.getParentFormObj();
244
- const parentForm = this.getParentForm();
243
+ // const parentFormObj = this.getParentFormObj();
244
+ // const parentForm = this.getParentForm();
245
245
 
246
- if (params.name) {
247
- // 判断是否将当前的name前缀加上,以便父级嵌套表单更新值
248
- const nameTemp = `${!params.name.startsWith(name) && name ? `${name}.` : ''}${params.name}`;
249
- // 将值同步给父级嵌套表单
250
- parentFormObj?.__setValueImmediate__?.({
251
- name: nameTemp,
252
- value: params.value,
253
- });
254
- } else if (parentFormObj?.formObjName) {
255
- // 外部直接调用formObj.setValue的情况下,触发父级嵌套表单值更新
256
- parentFormObj?.__setValueImmediate__?.({ name, value });
257
- }
246
+ // if (params.name) {
247
+ // // 判断是否将当前的name前缀加上,以便父级嵌套表单更新值
248
+ // const nameTemp = `${!params.name.startsWith(name) && name ? `${name}.` : ''}${params.name}`;
249
+ // // 将值同步给父级嵌套表单
250
+ // parentFormObj?.__setValueImmediate__?.({
251
+ // name: nameTemp,
252
+ // value: params.value,
253
+ // });
254
+ // } else if (parentFormObj?.formObjName) {
255
+ // // 外部直接调用formObj.setValue的情况下,触发父级嵌套表单值更新
256
+ // parentFormObj?.__setValueImmediate__?.({ name, value });
257
+ // }
258
258
 
259
- if (!parentFormObj && parentForm) {
260
- // 触发父级普通表单值更新
261
- // 子组件向上同步值,不调用setValue
262
- // parentForm?.setValue?.({ [name]: value }, false, true);
263
- // 刷新父级普通表单的formData
264
- parentForm?.updateFormContext();
265
- }
259
+ // if (!parentFormObj && parentForm) {
260
+ // // 触发父级普通表单值更新
261
+ // // 子组件向上同步值,不调用setValue
262
+ // // parentForm?.setValue?.({ [name]: value }, false, true);
263
+ // // 刷新父级普通表单的formData
264
+ // parentForm?.updateFormContext();
265
+ // }
266
266
 
267
- this.setData({ objValue: value || {} });
268
- this.updateWidgetAPI();
269
- },
267
+ // this.setData({ objValue: value || {} });
268
+ // this.updateWidgetAPI();
269
+ // },
270
270
  },
271
271
  observers: {
272
272
  'disabled, readOnly': function (disabled, readOnly) {
@@ -35,7 +35,7 @@ Component({
35
35
  placeholderCls: `${WD_PREFIX}-form-input-wrap__placeholder weui-input__placeholder`,
36
36
  cls: '',
37
37
  currentInputValue: '',
38
- _hasClearIcon: false,
38
+ hasClearIcon: false,
39
39
  isFocus: false,
40
40
  counter: 0,
41
41
 
@@ -102,9 +102,9 @@ Component({
102
102
  },
103
103
  observers: {
104
104
  'disabled,clearable,isFocus,currentInputValue': function (disabled, clearable, isFocus, currentInputValue) {
105
- const _hasClearIcon = clearable && isFocus && !disabled && currentInputValue?.length > 0;
105
+ const hasClearIcon = clearable && isFocus && !disabled && currentInputValue?.length > 0;
106
106
  const counter = typeof currentInputValue === 'string' ? currentInputValue.length : 0;
107
- this.setData({ _hasClearIcon, counter });
107
+ this.setData({ hasClearIcon, counter });
108
108
  },
109
109
  'disabled,size,classRoot,wrapClassName,before,after': function (
110
110
  disabled,
@@ -56,14 +56,14 @@
56
56
  </view>
57
57
 
58
58
  <!-- 清除按钮 -->
59
- <block wx:if="{{_hasClearIcon}}">
60
- <view class="{{inputWrap}}__after" >
59
+ <block wx:if="{{hasClearIcon}}">
60
+ <view class="{{inputWrap}}__after">
61
61
  <wd-icon className="{{classPrefix}}-icon__trigger" name="td:close-circle-filled" size="{{iconSize}}" bind:touchstart="handleClear"></wd-icon>
62
62
  </view>
63
63
  </block>
64
64
 
65
65
  <!-- 后缀图标 -->
66
- <block wx:if="{{!_hasClearIcon && suffixType}}">
66
+ <block wx:if="{{!hasClearIcon && suffixType}}">
67
67
  <view class="{{inputWrap}}__after" data-type="suffix" bind:tap="inputAdornmentClick">
68
68
  <wd-icon name="{{suffixIcon}}" type="{{suffixType}}" src="{{suffixSrc}}" size="{{iconSize}}" className="{{root}}__icon-after"></wd-icon>
69
69
  </view>
@@ -76,7 +76,7 @@ Component({
76
76
  * 控制弹窗打开/关闭
77
77
  * @param {Boolean} isOpen
78
78
  */
79
- dealShow(isOpen, params, isTrigger = true) {
79
+ dealShow(isOpen, params) {
80
80
  let setImmediately = {
81
81
  maskPreToShow: true,
82
82
  isMaskShow: !isOpen,
@@ -92,9 +92,8 @@ Component({
92
92
  }
93
93
 
94
94
  this.setData(setImmediately);
95
- if (isTrigger) {
96
- this.triggerEvent(isOpen ? 'open' : 'close', params);
97
- }
95
+
96
+ this.triggerEvent(isOpen ? 'open' : 'close', params);
98
97
  },
99
98
  /**
100
99
  * 关闭弹窗
@@ -163,9 +162,6 @@ Component({
163
162
  modalBdClasses,
164
163
  });
165
164
  },
166
- defaultShow: function (defaultShow) {
167
- this.dealShow(defaultShow, {}, false);
168
- },
169
165
  'isBdShow,openInfo,closeInfo': function () {
170
166
  this.updateWidgetAPI();
171
167
  },
@@ -26,6 +26,7 @@ Component({
26
26
  placeholderCls: `${WD_PREFIX}-form-input-wrap__placeholder weui-input__placeholder`,
27
27
  _size: 'md',
28
28
  _focus: false,
29
+ isiOS: false,
29
30
  },
30
31
  methods: {
31
32
  handleChange: function (e) {
@@ -98,6 +99,8 @@ Component({
98
99
  attached: function () {
99
100
  this.init();
100
101
  this.updateWidgetAPI();
102
+ const isiOS = wx.getSystemInfoSync().system.includes('iOS');
103
+ this.setData({ isiOS });
101
104
  },
102
105
  },
103
106
  });
@@ -22,7 +22,19 @@
22
22
  borderedH5="{{borderedH5}}"
23
23
  >
24
24
  <view class="{{cls}}" wx:if="{{!readOnly}}">
25
- <textarea placeholder-class="{{placeholderCls}}" auto-focus="{{focus}}" auto-height="{{autoHeight}}" cursor-spacing="{{cursorSpacing}}" focus="{{focus}}" placeholder="{{placeholder}}" value="{{value}}" disabled="{{disabled}}" maxlength="{{maxLength}}" bind:input="handleChange" bind:focus="handleFocus" bind:blur="handleBlur" bindconfirm="handleConfirm"></textarea>
25
+ <block wx:if="{{autoHeight}}" >
26
+ <view class="wd-textarea__content">
27
+ <textarea class="wd-textarea__content_input" placeholder-class="{{placeholderCls}}" auto-focus="{{focus}}" cursor-spacing="{{cursorSpacing}}" focus="{{focus}}" placeholder="{{placeholder}}" value="{{value}}" disabled="{{disabled}}" maxlength="{{maxLength}}" bind:input="handleChange" bind:focus="handleFocus" bind:blur="handleBlur" bindconfirm="handleConfirm"></textarea>
28
+ <text class="wd-textarea__content_text">
29
+ {{value}}</text>
30
+ </view>
31
+ </block>
32
+ <block wx:else>
33
+ <textarea class="{{isiOS?'wd-textarea__ios':''}}" placeholder-class="{{placeholderCls}}" auto-focus="{{focus}}" auto-height="{{autoHeight}}" cursor-spacing="{{cursorSpacing}}" focus="{{focus}}" placeholder="{{placeholder}}" value="{{value}}" disabled="{{disabled}}" maxlength="{{maxLength}}" bind:input="handleChange" bind:focus="handleFocus" bind:blur="handleBlur" bindconfirm="handleConfirm"></textarea>
34
+ </block>
35
+ </view>
36
+ <view>
37
+
26
38
  <block wx:if="{{counterVisible}}">
27
39
  <label class="{{countCls}}">{{counter}}/{{maxLength}}</label>
28
40
  </block>
@@ -5,3 +5,8 @@
5
5
  @import '../wd-input-wrap/wd-input-wrap.wxss';
6
6
 
7
7
  @import './wd-textarea.wxss';
8
+
9
+ .wd-mp-textarea-root .wd-form-input-wrap textarea.wd-textarea__ios {
10
+ width: 100%;
11
+ height: 3rem;
12
+ }
@@ -53,19 +53,9 @@ Component({
53
53
  },
54
54
  methods: {
55
55
  async getPhoneNumber(e) {
56
- if (
57
- e?.detail?.errMsg?.includes('fail') ||
58
- e?.detail?.errno ||
59
- !e?.detail?.code
60
- ) {
61
- console.warn(
62
- '获取手机号失败:',
63
- e?.detail || { errMsg: '可能基础库版本过低' }
64
- );
65
- this.triggerEvent(
66
- 'phonefail',
67
- e?.detail || { errMsg: '获取手机号失败,可能基础库版本过低' }
68
- );
56
+ if (e?.detail?.errMsg?.includes('fail') || e?.detail?.errno || !e?.detail?.code) {
57
+ console.warn('获取手机号失败:', e?.detail || { errMsg: '可能基础库版本过低' });
58
+ this.triggerEvent('phonefail', e?.detail || { errMsg: '获取手机号失败,可能基础库版本过低' });
69
59
  return;
70
60
  }
71
61
  const res = await callWedaApi({
@@ -75,6 +65,7 @@ Component({
75
65
  Method: 'InvokeComponentWxData',
76
66
  ReqBody: JSON.stringify({ code: e?.detail?.code }),
77
67
  },
68
+ wxAppId: wx.getAccountInfoSync()?.miniProgram?.appId,
78
69
  });
79
70
  if (!res?.Data) {
80
71
  this.triggerEvent('phonefail', { errMsg: '获取手机号失败' });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "miniprogram": "./",
4
4
  "packageManager": "yarn@3.0.2",
5
5
  "dependencies": {},
6
- "version": "3.18.8",
6
+ "version": "3.20.0",
7
7
  "main": "./",
8
8
  "publishConfig": {
9
9
  "access": "public"