import{ax as i,z as a,A as n,b5 as l}from"./chunks/framework.DRScawWW.js";const E=JSON.parse('{"title":"Form组件属性 props","description":"","frontmatter":{},"headers":[],"relativePath":"api/form/form-props.md","filePath":"api/form/form-props.md"}'),h={name:"api/form/form-props.md"};function t(k,s,p,e,r,g){return n(),a("div",null,[...s[0]||(s[0]=[l(`

Form组件属性 props

config

html
<template>
  <m-form-dialog :config="config"></m-form-dialog>
</template>

<script setup>
  import { ref } from "Vue";

  const config = ref([
    {
      name: "text",
      text: "文本",
    },
    {
      name: "multiple",
      text: "多行文本",
      type: "switch",
    },
  ]);
</script>

initValues

html
<template>
  <m-form-dialog :init-values="initValues"></m-form-dialog>
</template>

<script setup>
  import { ref } from 'Vue';

  const initValues = ref([
    text: 'text',
    multiply: true,
  ]);
</script>

lastValues

isCompare

showDiff

html
<template>
  <m-form :config="config" :is-compare="true" :last-values="lastValues" :show-diff="showDiff"></m-form>
</template>

<script setup>
  import { isEqual } from 'lodash-es';

  const showDiff = ({ curValue, lastValue, config }) => {
    if (config?.type === 'code-select') {
      // 业务侧自定义:双方都是“空形态”视为相等,不展示对比
      const isEmpty = (v) =>
        v === '' || v === undefined || v === null ||
        (typeof v === 'object' && v.hookType === 'code' && Array.isArray(v.hookData) && v.hookData.length === 0);
      if (isEmpty(curValue) && isEmpty(lastValue)) return false;
    }
    return !isEqual(curValue, lastValue);
  };
</script>

parentValues

labelWidth

表单域标签的宽度,例如 '50px'。 作为 Form 直接子元素的 form-item 会继承该值。 支持 auto

disabled

height

stepActive

size

inline

labelPosition

keyProp

popperClass

preventSubmitDefault

useFieldTextInError

extendState

`,42)])])}const y=i(h,[["render",t]]);export{E as __pageData,y as default};