@tmagic/form 1.3.0-alpha.8 → 1.3.0-alpha.9

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.
@@ -3360,12 +3360,16 @@
3360
3360
  return value === v;
3361
3361
  };
3362
3362
  const mapOptions = (data) => {
3363
- const { option } = props.config;
3364
- const { text } = option;
3365
- const { value } = option;
3363
+ const {
3364
+ option = {
3365
+ text: "text",
3366
+ value: "value"
3367
+ }
3368
+ } = props.config;
3369
+ const { text = "text", value = "value" } = option;
3366
3370
  return data.map((item) => ({
3367
- text: typeof text === "function" ? text(item) : item[text || "text"],
3368
- value: typeof value === "function" ? value(item) : item[value || "value"]
3371
+ text: typeof text === "function" ? text(item) : item[text],
3372
+ value: typeof value === "function" ? value(item) : item[value]
3369
3373
  }));
3370
3374
  };
3371
3375
  const getOptions = async () => {
@@ -3376,8 +3380,9 @@
3376
3380
  }
3377
3381
  loading.value = true;
3378
3382
  let items = [];
3379
- const { config } = props;
3380
- const { option } = config;
3383
+ const { option } = props.config;
3384
+ if (!option)
3385
+ return [];
3381
3386
  const { root = "", totalKey = "total" } = option;
3382
3387
  let { body = {}, url } = option;
3383
3388
  if (typeof url === "function") {
@@ -3474,8 +3479,9 @@
3474
3479
  const getInitOption = async () => {
3475
3480
  if (!props.model)
3476
3481
  return [];
3477
- const { config } = props;
3478
- const { option } = config;
3482
+ const { option } = props.config;
3483
+ if (!option)
3484
+ return [];
3479
3485
  const { root = "", initRoot = "" } = option;
3480
3486
  let { initBody = {} } = option;
3481
3487
  let options2 = [];