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