/*! For license information please see 6462.96c53fcc.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["6462"],{95339:function(s,a,n){"use strict";n.r(a);var l=n("80681");let t=["innerHTML"];a.default={setup:()=>({html:""}),render:()=>((0,l.wg)(),(0,l.iD)("div",{class:"van-doc-markdown-body",innerHTML:'

Form \u8868\u5355

\n

\u4ECB\u7ECD

\n

\u7528\u4E8E\u6570\u636E\u5F55\u5165\u3001\u6821\u9A8C\uFF0C\u652F\u6301\u8F93\u5165\u6846\u3001\u5355\u9009\u6846\u3001\u590D\u9009\u6846\u3001\u6587\u4EF6\u4E0A\u4F20\u7B49\u7C7B\u578B\uFF0C\u9700\u8981\u4E0E Field \u8F93\u5165\u6846 \u7EC4\u4EF6\u642D\u914D\u4F7F\u7528\u3002

\n

\u5F15\u5165

\n

\u901A\u8FC7\u4EE5\u4E0B\u65B9\u5F0F\u6765\u5168\u5C40\u6CE8\u518C\u7EC4\u4EF6\uFF0C\u66F4\u591A\u6CE8\u518C\u65B9\u5F0F\u8BF7\u53C2\u8003\u7EC4\u4EF6\u6CE8\u518C\u3002

\n
import { createApp } from 'vue';\nimport { Form, Field, CellGroup } from 'vant';\n\nconst app = createApp();\napp.use(Form);\napp.use(Field);\napp.use(CellGroup);\n
\n

\u4EE3\u7801\u6F14\u793A

\n

\u57FA\u7840\u7528\u6CD5

\n

\u5728\u8868\u5355\u4E2D\uFF0C\u6BCF\u4E2A Field \u7EC4\u4EF6 \u4EE3\u8868\u4E00\u4E2A\u8868\u5355\u9879\uFF0C\u4F7F\u7528 Field \u7684 rules \u5C5E\u6027\u5B9A\u4E49\u6821\u9A8C\u89C4\u5219\u3002

\n
<van-form @submit="onSubmit">\n  <van-cell-group inset>\n    <van-field\n      v-model="username"\n      name="\u7528\u6237\u540D"\n      label="\u7528\u6237\u540D"\n      placeholder="\u7528\u6237\u540D"\n      :rules="[{ required: true, message: '\u8BF7\u586B\u5199\u7528\u6237\u540D' }]"\n    />\n    <van-field\n      v-model="password"\n      type="password"\n      name="\u5BC6\u7801"\n      label="\u5BC6\u7801"\n      placeholder="\u5BC6\u7801"\n      :rules="[{ required: true, message: '\u8BF7\u586B\u5199\u5BC6\u7801' }]"\n    />\n  </van-cell-group>\n  <div style="margin: 16px;">\n    <van-button round block type="primary" native-type="submit">\n      \u63D0\u4EA4\n    </van-button>\n  </div>\n</van-form>\n
\n
import { ref } from 'vue';\n\nexport default {\n  setup() {\n    const username = ref('');\n    const password = ref('');\n    const onSubmit = (values) => {\n      console.log('submit', values);\n    };\n\n    return {\n      username,\n      password,\n      onSubmit,\n    };\n  },\n};\n
\n

\u6821\u9A8C\u89C4\u5219

\n

\u901A\u8FC7 rules \u5B9A\u4E49\u8868\u5355\u6821\u9A8C\u89C4\u5219\uFF0C\u6240\u6709\u53EF\u7528\u5B57\u6BB5\u89C1\u4E0B\u65B9\u8868\u683C\u3002

\n
<van-form @failed="onFailed">\n  <van-cell-group inset>\n    <!-- \u901A\u8FC7 pattern \u8FDB\u884C\u6B63\u5219\u6821\u9A8C -->\n    <van-field\n      v-model="value1"\n      name="pattern"\n      placeholder="\u6B63\u5219\u6821\u9A8C"\n      :rules="[{ pattern, message: '\u8BF7\u8F93\u5165\u6B63\u786E\u5185\u5BB9' }]"\n    />\n    <!-- \u901A\u8FC7 validator \u8FDB\u884C\u51FD\u6570\u6821\u9A8C -->\n    <van-field\n      v-model="value2"\n      name="validator"\n      placeholder="\u51FD\u6570\u6821\u9A8C"\n      :rules="[{ validator, message: '\u8BF7\u8F93\u5165\u6B63\u786E\u5185\u5BB9' }]"\n    />\n    <!-- \u901A\u8FC7 validator \u8FD4\u56DE\u9519\u8BEF\u63D0\u793A -->\n    <van-field\n      v-model="value3"\n      name="validatorMessage"\n      placeholder="\u6821\u9A8C\u51FD\u6570\u8FD4\u56DE\u9519\u8BEF\u63D0\u793A"\n      :rules="[{ validator: validatorMessage }]"\n    />\n    <!-- \u901A\u8FC7 validator \u8FDB\u884C\u5F02\u6B65\u51FD\u6570\u6821\u9A8C -->\n    <van-field\n      v-model="value4"\n      name="asyncValidator"\n      placeholder="\u5F02\u6B65\u51FD\u6570\u6821\u9A8C"\n      :rules="[{ validator: asyncValidator, message: '\u8BF7\u8F93\u5165\u6B63\u786E\u5185\u5BB9' }]"\n    />\n  </van-cell-group>\n  <div style="margin: 16px;">\n    <van-button round block type="primary" native-type="submit">\n      \u63D0\u4EA4\n    </van-button>\n  </div>\n</van-form>\n
\n
import { ref } from 'vue';\nimport { closeToast, showLoadingToast } from 'vant';\n\nexport default {\n  setup() {\n    const value1 = ref('');\n    const value2 = ref('');\n    const value3 = ref('abc');\n    const value4 = ref('');\n    const pattern = /\\d{6}/;\n\n    // \u6821\u9A8C\u51FD\u6570\u8FD4\u56DE true \u8868\u793A\u6821\u9A8C\u901A\u8FC7\uFF0Cfalse \u8868\u793A\u4E0D\u901A\u8FC7\n    const validator = (val) => /1\\d{10}/.test(val);\n\n    // \u6821\u9A8C\u51FD\u6570\u53EF\u4EE5\u76F4\u63A5\u8FD4\u56DE\u4E00\u6BB5\u9519\u8BEF\u63D0\u793A\n    const validatorMessage = (val) => `${val} \u4E0D\u5408\u6CD5\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165`;\n\n    // \u6821\u9A8C\u51FD\u6570\u53EF\u4EE5\u8FD4\u56DE Promise\uFF0C\u5B9E\u73B0\u5F02\u6B65\u6821\u9A8C\n    const asyncValidator = (val) =>\n      new Promise((resolve) => {\n        showLoadingToast('\u9A8C\u8BC1\u4E2D...');\n\n        setTimeout(() => {\n          closeToast();\n          resolve(val === '1234');\n        }, 1000);\n      });\n\n    const onFailed = (errorInfo) => {\n      console.log('failed', errorInfo);\n    };\n\n    return {\n      value1,\n      value2,\n      value3,\n      value4,\n      pattern,\n      onFailed,\n      validator,\n      asyncValidator,\n    };\n  },\n};\n
\n

\u8868\u5355\u9879\u7C7B\u578B - \u5F00\u5173

\n

\u5728\u8868\u5355\u4E2D\u4F7F\u7528 Switch \u7EC4\u4EF6\u3002

\n
<van-field name="switch" label="\u5F00\u5173">\n  <template #input>\n    <van-switch v-model="checked" />\n  </template>\n</van-field>\n
\n
import { ref } from 'vue';\n\nexport default {\n  setup() {\n    const checked = ref(false);\n    return { checked };\n  },\n};\n
\n

\u8868\u5355\u9879\u7C7B\u578B - \u590D\u9009\u6846

\n

\u5728\u8868\u5355\u4E2D\u4F7F\u7528 Checkbox \u7EC4\u4EF6\u3002

\n
<van-field name="checkbox" label="\u590D\u9009\u6846">\n  <template #input>\n    <van-checkbox v-model="checked" shape="square" />\n  </template>\n</van-field>\n<van-field name="checkboxGroup" label="\u590D\u9009\u6846\u7EC4">\n  <template #input>\n    <van-checkbox-group v-model="groupChecked" direction="horizontal">\n      <van-checkbox name="1" shape="square">\u590D\u9009\u6846 1</van-checkbox>\n      <van-checkbox name="2" shape="square">\u590D\u9009\u6846 2</van-checkbox>\n    </van-checkbox-group>\n  </template>\n</van-field>\n
\n
import { ref } from 'vue';\n\nexport default {\n  setup() {\n    const checked = ref(false);\n    const groupChecked = ref([]);\n    return {\n      checked,\n      groupChecked,\n    };\n  },\n};\n
\n

\u8868\u5355\u9879\u7C7B\u578B - \u5355\u9009\u6846

\n

\u5728\u8868\u5355\u4E2D\u4F7F\u7528 Radio \u7EC4\u4EF6\u3002

\n
<van-field name="radio" label="\u5355\u9009\u6846">\n  <template #input>\n    <van-radio-group v-model="checked" direction="horizontal">\n      <van-radio name="1">\u5355\u9009\u6846 1</van-radio>\n      <van-radio name="2">\u5355\u9009\u6846 2</van-radio>\n    </van-radio-group>\n  </template>\n</van-field>\n
\n
import { ref } from 'vue';\n\nexport default {\n  setup() {\n    const checked = ref('1');\n    return { checked };\n  },\n};\n
\n

\u8868\u5355\u9879\u7C7B\u578B - \u6B65\u8FDB\u5668

\n

\u5728\u8868\u5355\u4E2D\u4F7F\u7528 Stepper \u7EC4\u4EF6\u3002

\n
<van-field name="stepper" label="\u6B65\u8FDB\u5668">\n  <template #input>\n    <van-stepper v-model="value" />\n  </template>\n</van-field>\n
\n
import { ref } from 'vue';\n\nexport default {\n  setup() {\n    const value = ref(1);\n    return { value };\n  },\n};\n
\n

\u8868\u5355\u9879\u7C7B\u578B - \u8BC4\u5206

\n

\u5728\u8868\u5355\u4E2D\u4F7F\u7528 Rate \u7EC4\u4EF6\u3002

\n
<van-field name="rate" label="\u8BC4\u5206">\n  <template #input>\n    <van-rate v-model="value" />\n  </template>\n</van-field>\n
\n
import { ref } from 'vue';\n\nexport default {\n  setup() {\n    const value = ref(3);\n    return { value };\n  },\n};\n
\n

\u8868\u5355\u9879\u7C7B\u578B - \u6ED1\u5757

\n

\u5728\u8868\u5355\u4E2D\u4F7F\u7528 Slider \u7EC4\u4EF6\u3002

\n
<van-field name="slider" label="\u6ED1\u5757">\n  <template #input>\n    <van-slider v-model="value" />\n  </template>\n</van-field>\n
\n
import { ref } from 'vue';\n\nexport default {\n  setup() {\n    const value = ref(50);\n    return { value };\n  },\n};\n
\n

\u8868\u5355\u9879\u7C7B\u578B - \u6587\u4EF6\u4E0A\u4F20

\n

\u5728\u8868\u5355\u4E2D\u4F7F\u7528 Uploader \u7EC4\u4EF6\u3002

\n
<van-field name="uploader" label="\u6587\u4EF6\u4E0A\u4F20">\n  <template #input>\n    <van-uploader v-model="value" />\n  </template>\n</van-field>\n
\n
import { ref } from 'vue';\n\nexport default {\n  setup() {\n    const value = ref([\n      { url: 'https://fastly.jsdelivr.net/npm/@vant/assets/leaf.jpeg' },\n    ]);\n    return { value };\n  },\n};\n
\n

\u8868\u5355\u9879\u7C7B\u578B - \u9009\u62E9\u5668

\n

\u5728\u8868\u5355\u4E2D\u4F7F\u7528 Picker \u7EC4\u4EF6\u3002

\n
<van-field\n  v-model="result"\n  is-link\n  readonly\n  name="picker"\n  label="\u9009\u62E9\u5668"\n  placeholder="\u70B9\u51FB\u9009\u62E9\u57CE\u5E02"\n  @click="showPicker = true"\n/>\n<van-popup v-model:show="showPicker" position="bottom">\n  <van-picker\n    :columns="columns"\n    @confirm="onConfirm"\n    @cancel="showPicker = false"\n  />\n</van-popup>\n
\n
import { ref } from 'vue';\n\nexport default {\n  setup() {\n    const result = ref('');\n    const showPicker = ref(false);\n    const columns = [\n      { text: '\u676D\u5DDE', value: 'Hangzhou' },\n      { text: '\u5B81\u6CE2', value: 'Ningbo' },\n      { text: '\u6E29\u5DDE', value: 'Wenzhou' },\n      { text: '\u7ECD\u5174', value: 'Shaoxing' },\n      { text: '\u6E56\u5DDE', value: 'Huzhou' },\n    ];\n\n    const onConfirm = ({ selectedOptions }) => {\n      result.value = selectedOptions[0]?.text;\n      showPicker.value = false;\n    };\n\n    return {\n      result,\n      columns,\n      onConfirm,\n      showPicker,\n    };\n  },\n};\n
\n

\u8868\u5355\u9879\u7C7B\u578B - \u65E5\u671F\u9009\u62E9\u5668

\n

\u5728\u8868\u5355\u4E2D\u4F7F\u7528 DatePicker \u7EC4\u4EF6\u3002

\n
<van-field\n  v-model="result"\n  is-link\n  readonly\n  name="datePicker"\n  label="\u65F6\u95F4\u9009\u62E9"\n  placeholder="\u70B9\u51FB\u9009\u62E9\u65F6\u95F4"\n  @click="showPicker = true"\n/>\n<van-popup v-model:show="showPicker" position="bottom">\n  <van-date-picker @confirm="onConfirm" @cancel="showPicker = false" />\n</van-popup>\n
\n
import { ref } from 'vue';\n\nexport default {\n  setup() {\n    const result = ref('');\n    const showPicker = ref(false);\n    const onConfirm = ({ selectedValues }) => {\n      result.value = selectedValues.join('/');\n      showPicker.value = false;\n    };\n\n    return {\n      result,\n      onConfirm,\n      showPicker,\n    };\n  },\n};\n
\n

\u8868\u5355\u9879\u7C7B\u578B - \u7701\u5E02\u533A\u9009\u62E9\u5668

\n

\u5728\u8868\u5355\u4E2D\u4F7F\u7528 Area \u7EC4\u4EF6\u3002

\n
<van-field\n  v-model="result"\n  is-link\n  readonly\n  name="area"\n  label="\u5730\u533A\u9009\u62E9"\n  placeholder="\u70B9\u51FB\u9009\u62E9\u7701\u5E02\u533A"\n  @click="showArea = true"\n/>\n<van-popup v-model:show="showArea" position="bottom">\n  <van-area\n    :area-list="areaList"\n    @confirm="onConfirm"\n    @cancel="showArea = false"\n  />\n</van-popup>\n
\n
import { ref } from 'vue';\nimport { areaList } from '@vant/area-data';\n\nexport default {\n  setup() {\n    const result = ref('');\n    const showArea = ref(false);\n    const onConfirm = ({ selectedOptions }) => {\n      showArea.value = false;\n      result.value = selectedOptions.map((item) => item.text).join('/');\n    };\n\n    return {\n      result,\n      areaList,\n      showArea,\n      onConfirm,\n    };\n  },\n};\n
\n

\u8868\u5355\u9879\u7C7B\u578B - \u65E5\u5386

\n

\u5728\u8868\u5355\u4E2D\u4F7F\u7528 Calendar \u7EC4\u4EF6\u3002

\n
<van-field\n  v-model="result"\n  is-link\n  readonly\n  name="calendar"\n  label="\u65E5\u5386"\n  placeholder="\u70B9\u51FB\u9009\u62E9\u65E5\u671F"\n  @click="showCalendar = true"\n/>\n<van-calendar v-model:show="showCalendar" @confirm="onConfirm" />\n
\n
import { ref } from 'vue';\n\nexport default {\n  setup() {\n    const result = ref('');\n    const showCalendar = ref(false);\n    const onConfirm = (date) => {\n      result.value = `${date.getMonth() + 1}/${date.getDate()}`;\n      showCalendar.value = false;\n    };\n\n    return {\n      result,\n      onConfirm,\n      showCalendar,\n    };\n  },\n};\n
\n

API

\n

Props

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u53C2\u6570\u8BF4\u660E\u7C7B\u578B\u9ED8\u8BA4\u503C
label-width\u8868\u5355\u9879 label \u5BBD\u5EA6\uFF0C\u9ED8\u8BA4\u5355\u4F4D\u4E3Apxnumber | string6.2em
label-align\u8868\u5355\u9879 label \u5BF9\u9F50\u65B9\u5F0F\uFF0C\u53EF\u9009\u503C\u4E3A center right topstringleft
input-align\u8F93\u5165\u6846\u5BF9\u9F50\u65B9\u5F0F\uFF0C\u53EF\u9009\u503C\u4E3A center rightstringleft
error-message-align\u9519\u8BEF\u63D0\u793A\u6587\u6848\u5BF9\u9F50\u65B9\u5F0F\uFF0C\u53EF\u9009\u503C\u4E3A center rightstringleft
validate-trigger\u8868\u5355\u6821\u9A8C\u89E6\u53D1\u65F6\u673A\uFF0C\u53EF\u9009\u503C\u4E3A onChange\u3001onSubmit\uFF0C\u652F\u6301\u901A\u8FC7\u6570\u7EC4\u540C\u65F6\u8BBE\u7F6E\u591A\u4E2A\u503C\uFF0C\u5177\u4F53\u7528\u6CD5\u89C1\u4E0B\u65B9\u8868\u683Cstring | string[]onBlur
colon\u662F\u5426\u5728 label \u540E\u9762\u6DFB\u52A0\u5192\u53F7booleanfalse
disabled\u662F\u5426\u7981\u7528\u8868\u5355\u4E2D\u7684\u6240\u6709\u8F93\u5165\u6846booleanfalse
readonly\u662F\u5426\u5C06\u8868\u5355\u4E2D\u7684\u6240\u6709\u8F93\u5165\u6846\u8BBE\u7F6E\u4E3A\u53EA\u8BFB\u72B6\u6001booleanfalse
required v4.7.3\u662F\u5426\u663E\u793A\u8868\u5355\u5FC5\u586B\u661F\u53F7boolean | \'auto\'null
validate-first\u662F\u5426\u5728\u67D0\u4E00\u9879\u6821\u9A8C\u4E0D\u901A\u8FC7\u65F6\u505C\u6B62\u6821\u9A8Cbooleanfalse
scroll-to-error\u662F\u5426\u5728\u63D0\u4EA4\u8868\u5355\u4E14\u6821\u9A8C\u4E0D\u901A\u8FC7\u65F6\u6EDA\u52A8\u81F3\u9519\u8BEF\u7684\u8868\u5355\u9879booleanfalse
show-error\u662F\u5426\u5728\u6821\u9A8C\u4E0D\u901A\u8FC7\u65F6\u6807\u7EA2\u8F93\u5165\u6846booleanfalse
show-error-message\u662F\u5426\u5728\u6821\u9A8C\u4E0D\u901A\u8FC7\u65F6\u5728\u8F93\u5165\u6846\u4E0B\u65B9\u5C55\u793A\u9519\u8BEF\u63D0\u793Abooleantrue
submit-on-enter\u662F\u5426\u5728\u6309\u4E0B\u56DE\u8F66\u952E\u65F6\u63D0\u4EA4\u8868\u5355booleantrue
\n
\n

\u8868\u5355\u9879\u7684 API \u53C2\u89C1\uFF1AField \u7EC4\u4EF6

\n
\n

Rule \u6570\u636E\u7ED3\u6784

\n

\u4F7F\u7528 Field \u7684 rules \u5C5E\u6027\u53EF\u4EE5\u5B9A\u4E49\u6821\u9A8C\u89C4\u5219\uFF0C\u53EF\u9009\u5C5E\u6027\u5982\u4E0B:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u952E\u540D\u8BF4\u660E\u7C7B\u578B
required\u662F\u5426\u4E3A\u5FC5\u9009\u5B57\u6BB5\uFF0C\u5F53\u503C\u4E3A\u7A7A\u503C\u65F6\uFF08\u7A7A\u5B57\u7B26\u4E32\u3001\u7A7A\u6570\u7EC4\u3001false\u3001undefined\u3001null \uFF09\uFF0C\u6821\u9A8C\u4E0D\u901A\u8FC7boolean
message\u9519\u8BEF\u63D0\u793A\u6587\u6848\uFF0C\u53EF\u4EE5\u8BBE\u7F6E\u4E3A\u4E00\u4E2A\u51FD\u6570\u6765\u8FD4\u56DE\u52A8\u6001\u7684\u6587\u6848\u5185\u5BB9string | (value, rule) => string
validator\u901A\u8FC7\u51FD\u6570\u8FDB\u884C\u6821\u9A8C\uFF0C\u53EF\u4EE5\u8FD4\u56DE\u4E00\u4E2A Promise \u6765\u8FDB\u884C\u5F02\u6B65\u6821\u9A8C(value, rule) => boolean | string | Promise
pattern\u901A\u8FC7\u6B63\u5219\u8868\u8FBE\u5F0F\u8FDB\u884C\u6821\u9A8C\uFF0C\u6B63\u5219\u65E0\u6CD5\u5339\u914D\u8868\u793A\u6821\u9A8C\u4E0D\u901A\u8FC7RegExp
trigger\u8BBE\u7F6E\u672C\u9879\u89C4\u5219\u7684\u89E6\u53D1\u65F6\u673A\uFF0C\u4F18\u5148\u7EA7\u9AD8\u4E8E Form \u7EC4\u4EF6\u8BBE\u7F6E\u7684 validate-trigger \u5C5E\u6027\uFF0C\u53EF\u9009\u503C\u4E3A onChange\u3001onBlur\u3001onSubmitstring | string[]
formatter\u683C\u5F0F\u5316\u51FD\u6570\uFF0C\u5C06\u8868\u5355\u9879\u7684\u503C\u8F6C\u6362\u540E\u8FDB\u884C\u6821\u9A8C(value, rule) => any
validateEmpty\u8BBE\u7F6E validator \u548C pattern \u662F\u5426\u8981\u5BF9\u7A7A\u503C\u8FDB\u884C\u6821\u9A8C\uFF0C\u9ED8\u8BA4\u503C\u4E3A true\uFF0C\u53EF\u4EE5\u8BBE\u7F6E\u4E3A false \u6765\u7981\u7528\u8BE5\u884C\u4E3Aboolean
\n

validate-trigger \u53EF\u9009\u503C

\n

\u901A\u8FC7 validate-trigger \u5C5E\u6027\u53EF\u4EE5\u81EA\u5B9A\u4E49\u8868\u5355\u6821\u9A8C\u7684\u89E6\u53D1\u65F6\u673A\u3002

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u503C\u63CF\u8FF0
onSubmit\u4EC5\u5728\u63D0\u4EA4\u8868\u5355\u65F6\u89E6\u53D1\u6821\u9A8C
onBlur\u5728\u63D0\u4EA4\u8868\u5355\u548C\u8F93\u5165\u6846\u5931\u7126\u65F6\u89E6\u53D1\u6821\u9A8C
onChange\u5728\u63D0\u4EA4\u8868\u5355\u548C\u8F93\u5165\u6846\u5185\u5BB9\u53D8\u5316\u65F6\u89E6\u53D1\u6821\u9A8C
\n

Events

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u4E8B\u4EF6\u540D\u8BF4\u660E\u56DE\u8C03\u53C2\u6570
submit\u63D0\u4EA4\u8868\u5355\u4E14\u9A8C\u8BC1\u901A\u8FC7\u540E\u89E6\u53D1values: object
failed\u63D0\u4EA4\u8868\u5355\u4E14\u9A8C\u8BC1\u4E0D\u901A\u8FC7\u540E\u89E6\u53D1errorInfo: { values: object, errors: object[] }
\n

\u65B9\u6CD5

\n

\u901A\u8FC7 ref \u53EF\u4EE5\u83B7\u53D6\u5230 Form \u5B9E\u4F8B\u5E76\u8C03\u7528\u5B9E\u4F8B\u65B9\u6CD5\uFF0C\u8BE6\u89C1\u7EC4\u4EF6\u5B9E\u4F8B\u65B9\u6CD5\u3002

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u65B9\u6CD5\u540D\u8BF4\u660E\u53C2\u6570\u8FD4\u56DE\u503C
submit\u63D0\u4EA4\u8868\u5355\uFF0C\u4E0E\u70B9\u51FB\u63D0\u4EA4\u6309\u94AE\u7684\u6548\u679C\u7B49\u4EF7--
getValues\u83B7\u53D6\u6240\u6709\u8868\u5355\u9879\u5F53\u524D\u7684\u503C-Record<string, unknown>
validate\u9A8C\u8BC1\u8868\u5355\uFF0C\u652F\u6301\u4F20\u5165\u4E00\u4E2A\u6216\u591A\u4E2A name \u6765\u9A8C\u8BC1\u5355\u4E2A\u6216\u90E8\u5206\u8868\u5355\u9879\uFF0C\u4E0D\u4F20\u5165 name \u65F6\uFF0C\u4F1A\u9A8C\u8BC1\u6240\u6709\u8868\u5355\u9879name?: string | string[]Promise<void>
resetValidation\u91CD\u7F6E\u8868\u5355\u9879\u7684\u9A8C\u8BC1\u63D0\u793A\uFF0C\u652F\u6301\u4F20\u5165\u4E00\u4E2A\u6216\u591A\u4E2A name \u6765\u91CD\u7F6E\u5355\u4E2A\u6216\u90E8\u5206\u8868\u5355\u9879\uFF0C\u4E0D\u4F20\u5165 name \u65F6\uFF0C\u4F1A\u91CD\u7F6E\u6240\u6709\u8868\u5355\u9879name?: string | string[]-
getValidationStatus\u83B7\u53D6\u6240\u6709\u8868\u5355\u9879\u7684\u6821\u9A8C\u72B6\u6001\uFF0C\u72B6\u6001\u5305\u62EC passed\u3001failed\u3001unvalidated-Record<string, FieldValidationStatus>
scrollToField\u6EDA\u52A8\u5230\u5BF9\u5E94\u8868\u5355\u9879\u7684\u4F4D\u7F6E\uFF0C\u9ED8\u8BA4\u6EDA\u52A8\u5230\u9876\u90E8\uFF0C\u7B2C\u4E8C\u4E2A\u53C2\u6570\u4F20 false \u53EF\u6EDA\u52A8\u81F3\u5E95\u90E8name: string, alignToTop: boolean-
\n

\u7C7B\u578B\u5B9A\u4E49

\n

\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A

\n
import type { FormProps, FormInstance } from 'vant';\n
\n

FormInstance \u662F\u7EC4\u4EF6\u5B9E\u4F8B\u7684\u7C7B\u578B\uFF0C\u7528\u6CD5\u5982\u4E0B\uFF1A

\n
import { ref } from 'vue';\nimport type { FormInstance } from 'vant';\n\nconst formRef = ref<FormInstance>();\n\nformRef.value?.submit();\n
\n

Slots

\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u540D\u79F0\u8BF4\u660E
default\u8868\u5355\u5185\u5BB9
\n

\u5E38\u89C1\u95EE\u9898

\n

\u5982\u4F55\u81EA\u5B9A\u4E49\u8868\u5355\u9879\uFF1F

\n

Vant \u652F\u6301\u5728 Form \u7EC4\u4EF6\u4E2D\u63D2\u5165\u81EA\u5B9A\u4E49\u7684\u8868\u5355\u9879\uFF0C\u5177\u4F53\u7528\u6CD5\u53C2\u89C1 useCustomFieldValue\u3002

\n
'},null,8,t))}}}]);