@cloudbase/weda-ui-mp 3.20.5 → 3.21.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.
@@ -6,6 +6,7 @@ import deepEqual from '../../../utils/deepEqual';
6
6
  import { getDefaultQuery } from '../../../utils/getModelParams';
7
7
  import { isFormatNeedFetch, isFormatWithFilterable } from './formats-util';
8
8
  import { textToString } from '../../../utils/platform';
9
+ import { errorHandler } from '../../../utils/error';
9
10
 
10
11
  const STATUS_CLOSED = 0;
11
12
  const STATUS_LOADING = 1;
@@ -346,28 +347,43 @@ Component({
346
347
  },
347
348
  // 获取通用选项集列表
348
349
  _fetchEnumData: async function () {
349
- let data = await callWedaApi({
350
- action: 'DescribeGeneralOptionsDetailList',
351
- data: {
352
- OptNameList: [this.properties.enumName],
353
- PageIndex: 1,
354
- PageSize: 10,
355
- },
356
- });
350
+ try {
351
+ let data = await callWedaApi({
352
+ action: 'DescribeGeneralOptionsDetailList',
353
+ data: {
354
+ OptNameList: [this.properties.enumName],
355
+ PageIndex: 1,
356
+ PageSize: 10,
357
+ },
358
+ });
357
359
 
358
- const config = destr(data?.Items?.[0]?.Config) ?? [];
359
- const option = config.map((item) => {
360
- return {
361
- label: item.value,
362
- value: item.key,
363
- name: item.value,
364
- };
365
- });
366
- this.setData({
367
- selectRange: option.map((item) => item.label),
368
- option,
369
- loadStatus: option.length > 0 ? 0 : STATUS_EMPTY,
370
- });
360
+ const config = destr(data?.Items?.[0]?.Config) ?? [];
361
+ const option = config.map((item) => {
362
+ return {
363
+ label: item.value,
364
+ value: item.key,
365
+ name: item.value,
366
+ };
367
+ });
368
+ const label = this.getLabels(this.data.value, option);
369
+ this.setData({
370
+ selectRange: option.map((item) => item.label),
371
+ option,
372
+ loadStatus: option.length > 0 ? 0 : STATUS_EMPTY,
373
+ displayValue: label,
374
+ });
375
+ } catch (error) {
376
+ errorHandler({
377
+ code: 'wdSelect.GetEnumDataError',
378
+ error: error,
379
+ });
380
+ this.setData({
381
+ loadStatus: STATUS_FAILED,
382
+ selectRange: [],
383
+ option: [],
384
+ displayValue: '',
385
+ });
386
+ }
371
387
  },
372
388
  getUniqueOption: function (option) {
373
389
  const optionMap = option.reduce((acc, item) => {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "miniprogram": "./",
4
4
  "packageManager": "yarn@3.0.2",
5
5
  "dependencies": {},
6
- "version": "3.20.5",
6
+ "version": "3.21.0",
7
7
  "main": "./",
8
8
  "publishConfig": {
9
9
  "access": "public"