/*! For license information please see 8057.7d5dae30.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["8057"],{69086:function(s,n,a){"use strict";a.r(n);var t=a("80681");let l=["innerHTML"];n.default={setup:()=>({html:""}),render:()=>((0,t.wg)(),(0,t.iD)("div",{class:"van-doc-markdown-body",innerHTML:'
\u7528\u6237\u53EF\u4EE5\u5728\u6587\u672C\u6846\u5185\u8F93\u5165\u6216\u7F16\u8F91\u6587\u5B57\u3002
\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
\nimport { createApp } from 'vue';\nimport { Field, CellGroup } from 'vant';\n\nconst app = createApp();\napp.use(Field);\napp.use(CellGroup);\n
\n\u53EF\u4EE5\u901A\u8FC7 v-model
\u53CC\u5411\u7ED1\u5B9A\u8F93\u5165\u6846\u7684\u503C\uFF0C\u901A\u8FC7 placeholder
\u8BBE\u7F6E\u5360\u4F4D\u63D0\u793A\u6587\u5B57\u3002
<!-- \u53EF\u4EE5\u4F7F\u7528 CellGroup \u4F5C\u4E3A\u5BB9\u5668 -->\n<van-cell-group inset>\n <van-field v-model="value" label="\u6587\u672C" placeholder="\u8BF7\u8F93\u5165\u7528\u6237\u540D" />\n</van-cell-group>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const value = ref('');\n return { value };\n },\n};\n
\n\u6839\u636E type
\u5C5E\u6027\u5B9A\u4E49\u4E0D\u540C\u7C7B\u578B\u7684\u8F93\u5165\u6846\uFF0C\u9ED8\u8BA4\u503C\u4E3A text
\u3002
<van-cell-group inset>\n <!-- \u8F93\u5165\u4EFB\u610F\u6587\u672C -->\n <van-field v-model="text" label="\u6587\u672C" />\n <!-- \u8F93\u5165\u624B\u673A\u53F7\uFF0C\u8C03\u8D77\u624B\u673A\u53F7\u952E\u76D8 -->\n <van-field v-model="tel" type="tel" label="\u624B\u673A\u53F7" />\n <!-- \u5141\u8BB8\u8F93\u5165\u6B63\u6574\u6570\uFF0C\u8C03\u8D77\u7EAF\u6570\u5B57\u952E\u76D8 -->\n <van-field v-model="digit" type="digit" label="\u6574\u6570" />\n <!-- \u5141\u8BB8\u8F93\u5165\u6570\u5B57\uFF0C\u8C03\u8D77\u5E26\u7B26\u53F7\u7684\u7EAF\u6570\u5B57\u952E\u76D8 -->\n <van-field v-model="number" type="number" label="\u6570\u5B57" />\n <!-- \u8F93\u5165\u5BC6\u7801 -->\n <van-field v-model="password" type="password" label="\u5BC6\u7801" />\n</van-cell-group>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const tel = ref('');\n const text = ref('');\n const digit = ref('');\n const number = ref('');\n const password = ref('');\n\n return { tel, text, digit, number, password };\n },\n};\n
\n\u901A\u8FC7 readonly
\u5C06\u8F93\u5165\u6846\u8BBE\u7F6E\u4E3A\u53EA\u8BFB\u72B6\u6001\uFF0C\u901A\u8FC7 disabled
\u5C06\u8F93\u5165\u6846\u8BBE\u7F6E\u4E3A\u7981\u7528\u72B6\u6001\u3002
<van-cell-group inset>\n <van-field label="\u6587\u672C" model-value="\u8F93\u5165\u6846\u53EA\u8BFB" readonly />\n <van-field label="\u6587\u672C" model-value="\u8F93\u5165\u6846\u5DF2\u7981\u7528" disabled />\n</van-cell-group>\n
\n\u901A\u8FC7 left-icon
\u548C right-icon
\u914D\u7F6E\u8F93\u5165\u6846\u4E24\u4FA7\u7684\u56FE\u6807\uFF0C\u901A\u8FC7\u8BBE\u7F6E clearable
\u5728\u8F93\u5165\u8FC7\u7A0B\u4E2D\u5C55\u793A\u6E05\u9664\u56FE\u6807\u3002
<van-cell-group inset>\n <van-field\n v-model="value1"\n label="\u6587\u672C"\n left-icon="smile-o"\n right-icon="warning-o"\n placeholder="\u663E\u793A\u56FE\u6807"\n />\n <van-field\n v-model="value2"\n clearable\n label="\u6587\u672C"\n left-icon="music-o"\n placeholder="\u663E\u793A\u6E05\u9664\u56FE\u6807"\n />\n</van-cell-group>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const value1 = ref('');\n const value2 = ref('123');\n return {\n value1,\n value2,\n };\n },\n};\n
\n\u8BBE\u7F6E required
\u5C5E\u6027\u6765\u5C55\u793A\u5FC5\u586B\u661F\u53F7\u3002
<van-cell-group inset>\n <van-field\n v-model="username"\n required\n label="\u7528\u6237\u540D"\n placeholder="\u8BF7\u8F93\u5165\u7528\u6237\u540D"\n />\n <van-field\n v-model="phone"\n required\n label="\u624B\u673A\u53F7"\n placeholder="\u8BF7\u8F93\u5165\u624B\u673A\u53F7"\n />\n</van-cell-group>\n
\n\u8BF7\u6CE8\u610F required
\u5C5E\u6027\u53EA\u7528\u4E8E\u63A7\u5236\u6837\u5F0F\u5C55\u793A\uFF0C\u5728\u8FDB\u884C\u8868\u5355\u6821\u9A8C\u65F6\uFF0C\u9700\u8981\u4F7F\u7528 rule.required
\u9009\u9879\u6765\u63A7\u5236\u6821\u9A8C\u903B\u8F91\u3002
\u4F60\u53EF\u4EE5\u5728 Form \u7EC4\u4EF6\u4E0A\u8BBE\u7F6E required="auto"
\uFF0C\u6B64\u65F6 Form \u91CC\u7684\u6240\u6709 Field \u4F1A\u81EA\u52A8\u6839\u636E rule.required
\u6765\u5224\u65AD\u662F\u5426\u9700\u8981\u5C55\u793A\u661F\u53F7\u3002
<van-form required="auto">\n <van-field\n v-model="username"\n :rules="[{ required: true }]"\n label="\u7528\u6237\u540D"\n placeholder="\u8BF7\u8F93\u5165\u7528\u6237\u540D"\n />\n <van-field\n v-model="phone"\n :rules="[{ required: false }]"\n label="\u624B\u673A\u53F7"\n placeholder="\u8BF7\u8F93\u5165\u624B\u673A\u53F7"\n />\n</van-form>\n
\n\u8BBE\u7F6E required
\u5C5E\u6027\u8868\u793A\u8FD9\u662F\u4E00\u4E2A\u5FC5\u586B\u9879\uFF0C\u53EF\u4EE5\u914D\u5408 error
\u6216 error-message
\u5C5E\u6027\u663E\u793A\u5BF9\u5E94\u7684\u9519\u8BEF\u63D0\u793A\u3002
<van-cell-group inset>\n <van-field\n v-model="username"\n error\n label="\u7528\u6237\u540D"\n placeholder="\u8BF7\u8F93\u5165\u7528\u6237\u540D"\n />\n <van-field\n v-model="phone"\n label="\u624B\u673A\u53F7"\n placeholder="\u8BF7\u8F93\u5165\u624B\u673A\u53F7"\n error-message="\u624B\u673A\u53F7\u683C\u5F0F\u9519\u8BEF"\n />\n</van-cell-group>\n
\n\u901A\u8FC7 button \u63D2\u69FD\u53EF\u4EE5\u5728\u8F93\u5165\u6846\u5C3E\u90E8\u63D2\u5165\u6309\u94AE\u3002
\n<van-cell-group inset>\n <van-field\n v-model="sms"\n center\n clearable\n label="\u77ED\u4FE1\u9A8C\u8BC1\u7801"\n placeholder="\u8BF7\u8F93\u5165\u77ED\u4FE1\u9A8C\u8BC1\u7801"\n >\n <template #button>\n <van-button size="small" type="primary">\u53D1\u9001\u9A8C\u8BC1\u7801</van-button>\n </template>\n </van-field>\n</van-cell-group>\n
\n\u901A\u8FC7 formatter
\u5C5E\u6027\u53EF\u4EE5\u5BF9\u8F93\u5165\u7684\u5185\u5BB9\u8FDB\u884C\u683C\u5F0F\u5316\uFF0C\u901A\u8FC7 format-trigger
\u5C5E\u6027\u53EF\u4EE5\u6307\u5B9A\u6267\u884C\u683C\u5F0F\u5316\u7684\u65F6\u673A\uFF0C\u9ED8\u8BA4\u5728\u8F93\u5165\u65F6\u8FDB\u884C\u683C\u5F0F\u5316\u3002
<van-cell-group inset>\n <van-field\n v-model="value1"\n label="\u6587\u672C"\n :formatter="formatter"\n placeholder="\u5728\u8F93\u5165\u65F6\u6267\u884C\u683C\u5F0F\u5316"\n />\n <van-field\n v-model="value2"\n label="\u6587\u672C"\n :formatter="formatter"\n format-trigger="onBlur"\n placeholder="\u5728\u5931\u7126\u65F6\u6267\u884C\u683C\u5F0F\u5316"\n />\n</van-cell-group>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const value1 = ref('');\n const value2 = ref('');\n // \u8FC7\u6EE4\u8F93\u5165\u7684\u6570\u5B57\n const formatter = (value) => value.replace(/\\d/g, '');\n\n return {\n value1,\n value2,\n formatter,\n };\n },\n};\n
\n\u5BF9\u4E8E textarea\uFF0C\u53EF\u4EE5\u901A\u8FC7 autosize
\u5C5E\u6027\u8BBE\u7F6E\u9AD8\u5EA6\u81EA\u9002\u5E94\u3002
<van-cell-group inset>\n <van-field\n v-model="message"\n rows="1"\n autosize\n label="\u7559\u8A00"\n type="textarea"\n placeholder="\u8BF7\u8F93\u5165\u7559\u8A00"\n />\n</van-cell-group>\n
\n\u8BBE\u7F6E maxlength
\u548C show-word-limit
\u5C5E\u6027\u540E\u4F1A\u5728\u5E95\u90E8\u663E\u793A\u5B57\u6570\u7EDF\u8BA1\u3002
<van-cell-group inset>\n <van-field\n v-model="message"\n rows="2"\n autosize\n label="\u7559\u8A00"\n type="textarea"\n maxlength="50"\n placeholder="\u8BF7\u8F93\u5165\u7559\u8A00"\n show-word-limit\n />\n</van-cell-group>\n
\n\u901A\u8FC7 input-align
\u5C5E\u6027\u53EF\u4EE5\u8BBE\u7F6E\u8F93\u5165\u6846\u5185\u5BB9\u7684\u5BF9\u9F50\u65B9\u5F0F\uFF0C\u53EF\u9009\u503C\u4E3A center
\u3001right
\u3002
<van-cell-group inset>\n <van-field\n v-model="value"\n label="\u6587\u672C"\n placeholder="\u8F93\u5165\u6846\u5185\u5BB9\u53F3\u5BF9\u9F50"\n input-align="right"\n />\n</van-cell-group>\n
\n\u901A\u8FC7 label-align
\u5C5E\u6027\u53EF\u4EE5\u8BBE\u7F6E\u8F93\u5165\u6846\u6587\u672C\u7684\u4F4D\u7F6E\uFF0C\u53EF\u9009\u503C\u4E3A center
\u3001right
\u3001top
\u3002
<van-cell-group inset>\n <van-field\n v-model="value"\n label="\u6587\u672C"\n placeholder="\u9876\u90E8\u5BF9\u9F50"\n label-align="top"\n />\n <van-field\n v-model="value2"\n label="\u6587\u672C"\n placeholder="\u5DE6\u5BF9\u9F50"\n label-align="left"\n />\n <van-field\n v-model="value3"\n label="\u6587\u672C"\n placeholder="\u5C45\u4E2D\u5BF9\u9F50"\n label-align="center"\n />\n <van-field\n v-model="value4"\n label="\u6587\u672C"\n placeholder="\u53F3\u5BF9\u9F50"\n label-align="right"\n />\n</van-cell-group>\n
\n\u53C2\u6570 | \n\u8BF4\u660E | \n\u7C7B\u578B | \n\u9ED8\u8BA4\u503C | \n
---|---|---|---|
v-model | \n\u5F53\u524D\u8F93\u5165\u7684\u503C | \nnumber | string | \n- | \n
label | \n\u8F93\u5165\u6846\u5DE6\u4FA7\u6587\u672C | \nstring | \n- | \n
name | \n\u540D\u79F0\uFF0C\u4F5C\u4E3A\u63D0\u4EA4\u8868\u5355\u65F6\u7684\u6807\u8BC6\u7B26 | \nstring | \n- | \n
id | \n\u8F93\u5165\u6846 id\uFF0C\u540C\u65F6\u4F1A\u8BBE\u7F6E label \u7684 for \u5C5E\u6027 | \nstring | \nvan-field-n-input | \n
type | \n\u8F93\u5165\u6846\u7C7B\u578B, \u652F\u6301\u539F\u751F input \u6807\u7B7E\u7684\u6240\u6709 type \u5C5E\u6027\uFF0C\u989D\u5916\u652F\u6301\u4E86 digit \u7C7B\u578B | \nFieldType | \ntext | \n
size | \n\u5927\u5C0F\uFF0C\u53EF\u9009\u503C\u4E3A large normal | \nstring | \n- | \n
maxlength | \n\u8F93\u5165\u7684\u6700\u5927\u5B57\u7B26\u6570 | \nnumber | string | \n- | \n
placeholder | \n\u8F93\u5165\u6846\u5360\u4F4D\u63D0\u793A\u6587\u5B57 | \nstring | \n- | \n
border | \n\u662F\u5426\u663E\u793A\u5185\u8FB9\u6846 | \nboolean | \ntrue | \n
disabled | \n\u662F\u5426\u7981\u7528\u8F93\u5165\u6846 | \nboolean | \nfalse | \n
readonly | \n\u662F\u5426\u4E3A\u53EA\u8BFB\u72B6\u6001\uFF0C\u53EA\u8BFB\u72B6\u6001\u4E0B\u65E0\u6CD5\u8F93\u5165\u5185\u5BB9 | \nboolean | \nfalse | \n
colon | \n\u662F\u5426\u5728 label \u540E\u9762\u6DFB\u52A0\u5192\u53F7 | \nboolean | \nfalse | \n
required | \n\u662F\u5426\u663E\u793A\u8868\u5355\u5FC5\u586B\u661F\u53F7 | \nboolean | \'auto\' | \nnull | \n
center | \n\u662F\u5426\u4F7F\u5185\u5BB9\u5782\u76F4\u5C45\u4E2D | \nboolean | \nfalse | \n
clearable | \n\u662F\u5426\u542F\u7528\u6E05\u9664\u56FE\u6807\uFF0C\u70B9\u51FB\u6E05\u9664\u56FE\u6807\u540E\u4F1A\u6E05\u7A7A\u8F93\u5165\u6846 | \nboolean | \nfalse | \n
clear-icon | \n\u6E05\u9664\u56FE\u6807\u540D\u79F0\u6216\u56FE\u7247\u94FE\u63A5\uFF0C\u7B49\u540C\u4E8E Icon \u7EC4\u4EF6\u7684 name \u5C5E\u6027 | \nstring | \nclear | \n
clear-trigger | \n\u663E\u793A\u6E05\u9664\u56FE\u6807\u7684\u65F6\u673A\uFF0Calways \u8868\u793A\u8F93\u5165\u6846\u4E0D\u4E3A\u7A7A\u65F6\u5C55\u793A\uFF0Cfocus \u8868\u793A\u8F93\u5165\u6846\u805A\u7126\u4E14\u4E0D\u4E3A\u7A7A\u65F6\u5C55\u793A | \nFieldClearTrigger | \nfocus | \n
clickable | \n\u662F\u5426\u5F00\u542F\u70B9\u51FB\u53CD\u9988 | \nboolean | \nfalse | \n
is-link | \n\u662F\u5426\u5C55\u793A\u53F3\u4FA7\u7BAD\u5934\u5E76\u5F00\u542F\u70B9\u51FB\u53CD\u9988 | \nboolean | \nfalse | \n
autofocus | \n\u662F\u5426\u81EA\u52A8\u805A\u7126\uFF0CiOS \u7CFB\u7EDF\u4E0D\u652F\u6301\u8BE5\u5C5E\u6027 | \nboolean | \nfalse | \n
show-word-limit | \n\u662F\u5426\u663E\u793A\u5B57\u6570\u7EDF\u8BA1\uFF0C\u9700\u8981\u8BBE\u7F6E maxlength \u5C5E\u6027 | \nboolean | \nfalse | \n
error | \n\u662F\u5426\u5C06\u8F93\u5165\u5185\u5BB9\u6807\u7EA2 | \nboolean | \nfalse | \n
error-message | \n\u5E95\u90E8\u9519\u8BEF\u63D0\u793A\u6587\u6848\uFF0C\u4E3A\u7A7A\u65F6\u4E0D\u5C55\u793A | \nstring | \n- | \n
error-message-align | \n\u9519\u8BEF\u63D0\u793A\u6587\u6848\u5BF9\u9F50\u65B9\u5F0F\uFF0C\u53EF\u9009\u503C\u4E3A center right | \nFieldTextAlign | \nleft | \n
formatter | \n\u8F93\u5165\u5185\u5BB9\u683C\u5F0F\u5316\u51FD\u6570 | \n(val: string) => string | \n- | \n
format-trigger | \n\u683C\u5F0F\u5316\u51FD\u6570\u89E6\u53D1\u7684\u65F6\u673A\uFF0C\u53EF\u9009\u503C\u4E3A onBlur | \nFieldFormatTrigger | \nonChange | \n
arrow-direction | \n\u7BAD\u5934\u65B9\u5411\uFF0C\u53EF\u9009\u503C\u4E3A left up down | \nstring | \nright | \n
label-class | \n\u5DE6\u4FA7\u6587\u672C\u989D\u5916\u7C7B\u540D | \nstring | Array | object | \n- | \n
label-width | \n\u5DE6\u4FA7\u6587\u672C\u5BBD\u5EA6\uFF0C\u9ED8\u8BA4\u5355\u4F4D\u4E3A px | \nnumber | string | \n6.2em | \n
label-align | \n\u5DE6\u4FA7\u6587\u672C\u5BF9\u9F50\u65B9\u5F0F\uFF0C\u53EF\u9009\u503C\u4E3A center right top | \nFieldTextAlign | \nleft | \n
input-align | \n\u8F93\u5165\u6846\u5BF9\u9F50\u65B9\u5F0F\uFF0C\u53EF\u9009\u503C\u4E3A center right | \nFieldTextAlign | \nleft | \n
autosize | \n\u662F\u5426\u81EA\u9002\u5E94\u5185\u5BB9\u9AD8\u5EA6\uFF0C\u53EA\u5BF9 textarea \u6709\u6548\uFF0C \u53EF\u4F20\u5165\u5BF9\u8C61,\u5982 { maxHeight: 100, minHeight: 50 }\uFF0C \u5355\u4F4D\u4E3A px | \nboolean | FieldAutosizeConfig | \nfalse | \n
left-icon | \n\u5DE6\u4FA7\u56FE\u6807\u540D\u79F0\u6216\u56FE\u7247\u94FE\u63A5\uFF0C\u7B49\u540C\u4E8E Icon \u7EC4\u4EF6\u7684 name \u5C5E\u6027 | \nstring | \n- | \n
right-icon | \n\u53F3\u4FA7\u56FE\u6807\u540D\u79F0\u6216\u56FE\u7247\u94FE\u63A5\uFF0C\u7B49\u540C\u4E8E Icon \u7EC4\u4EF6\u7684 name \u5C5E\u6027 | \nstring | \n- | \n
icon-prefix | \n\u56FE\u6807\u7C7B\u540D\u524D\u7F00\uFF0C\u7B49\u540C\u4E8E Icon \u7EC4\u4EF6\u7684 class-prefix \u5C5E\u6027 | \nstring | \nvan-icon | \n
rules | \n\u8868\u5355\u6821\u9A8C\u89C4\u5219\uFF0C\u8BE6\u89C1 Form \u7EC4\u4EF6 | \nFieldRule[] | \n- | \n
autocomplete | \nHTML \u539F\u751F\u5C5E\u6027\uFF0C\u7528\u4E8E\u63A7\u5236\u81EA\u52A8\u5B8C\u6210\u529F\u80FD\uFF0C\u8BE6\u89C1 MDN - autocomplete | \nstring | \n- | \n
autocapitalize v4.6.2 | \nHTML \u539F\u751F\u5C5E\u6027\uFF0C\u7528\u4E8E\u63A7\u5236\u6587\u672C\u8F93\u5165\u65F6\u662F\u5426\u81EA\u52A8\u5927\u5199\uFF0C\u6B64 API \u4EC5\u5728\u90E8\u5206\u6D4F\u89C8\u5668\u652F\u6301\uFF0C\u8BE6\u89C1 MDN - autocapitalize | \nstring | \n- | \n
enterkeyhint | \nHTML \u539F\u751F\u5C5E\u6027\uFF0C\u7528\u4E8E\u63A7\u5236\u56DE\u8F66\u952E\u6837\u5F0F\uFF0C\u6B64 API \u4EC5\u5728\u90E8\u5206\u6D4F\u89C8\u5668\u652F\u6301\uFF0C\u8BE6\u89C1 MDN - enterkeyhint | \nstring | \n- | \n
spellcheck v4.6.2 | \nHTML \u539F\u751F\u5C5E\u6027\uFF0C\u7528\u4E8E\u68C0\u67E5\u5143\u7D20\u7684\u62FC\u5199\u9519\u8BEF\uFF0C\u6B64 API \u4EC5\u5728\u90E8\u5206\u6D4F\u89C8\u5668\u652F\u6301\uFF0C\u8BE6\u89C1 MDN - spellcheck | \nboolean | \n- | \n
autocorrect v4.6.2 | \n\u4EC5 Safari \u9002\u7528\uFF0C\u7528\u4E8E\u81EA\u52A8\u66F4\u6B63\u8F93\u5165\u7684\u6587\u672C\uFF0C\u8BE6\u89C1 MDN - autocorrect | \nstring | \n- | \n
\u4E8B\u4EF6\u540D | \n\u8BF4\u660E | \n\u56DE\u8C03\u53C2\u6570 | \n
---|---|---|
update:model-value | \n\u8F93\u5165\u6846\u5185\u5BB9\u53D8\u5316\u65F6\u89E6\u53D1 | \nvalue: string (\u5F53\u524D\u8F93\u5165\u7684\u503C) | \n
focus | \n\u8F93\u5165\u6846\u83B7\u5F97\u7126\u70B9\u65F6\u89E6\u53D1 | \nevent: Event | \n
blur | \n\u8F93\u5165\u6846\u5931\u53BB\u7126\u70B9\u65F6\u89E6\u53D1 | \nevent: Event | \n
clear | \n\u70B9\u51FB\u6E05\u9664\u6309\u94AE\u65F6\u89E6\u53D1 | \nevent: MouseEvent | \n
click | \n\u70B9\u51FB\u7EC4\u4EF6\u65F6\u89E6\u53D1 | \nevent: MouseEvent | \n
click-input | \n\u70B9\u51FB\u8F93\u5165\u533A\u57DF\u65F6\u89E6\u53D1 | \nevent: MouseEvent | \n
click-left-icon | \n\u70B9\u51FB\u5DE6\u4FA7\u56FE\u6807\u65F6\u89E6\u53D1 | \nevent: MouseEvent | \n
click-right-icon | \n\u70B9\u51FB\u53F3\u4FA7\u56FE\u6807\u65F6\u89E6\u53D1 | \nevent: MouseEvent | \n
start-validate | \n\u5F00\u59CB\u8868\u5355\u6821\u9A8C\u65F6\u89E6\u53D1 | \n- | \n
end-validate | \n\u7ED3\u675F\u8868\u5355\u6821\u9A8C\u65F6\u89E6\u53D1 | \n{ status: string, message: string } | \n
\u901A\u8FC7 ref \u53EF\u4EE5\u83B7\u53D6\u5230 Field \u5B9E\u4F8B\u5E76\u8C03\u7528\u5B9E\u4F8B\u65B9\u6CD5\uFF0C\u8BE6\u89C1\u7EC4\u4EF6\u5B9E\u4F8B\u65B9\u6CD5\u3002
\n\u65B9\u6CD5\u540D | \n\u8BF4\u660E | \n\u53C2\u6570 | \n\u8FD4\u56DE\u503C | \n
---|---|---|---|
focus | \n\u83B7\u53D6\u8F93\u5165\u6846\u7126\u70B9 | \n- | \n- | \n
blur | \n\u53D6\u6D88\u8F93\u5165\u6846\u7126\u70B9 | \n- | \n- | \n
\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A
\nimport type {\n FieldType,\n FieldRule,\n FieldProps,\n FieldInstance,\n FieldTextAlign,\n FieldRuleMessage,\n FieldClearTrigger,\n FieldFormatTrigger,\n FieldRuleValidator,\n FieldRuleFormatter,\n FieldValidateError,\n FieldAutosizeConfig,\n FieldValidateTrigger,\n FieldValidationStatus,\n} from 'vant';\n
\nFieldInstance
\u662F\u7EC4\u4EF6\u5B9E\u4F8B\u7684\u7C7B\u578B\uFF0C\u7528\u6CD5\u5982\u4E0B\uFF1A
import { ref } from 'vue';\nimport type { FieldInstance } from 'vant';\n\nconst fieldRef = ref<FieldInstance>();\n\nfieldRef.value?.focus();\n
\n\u540D\u79F0 | \n\u8BF4\u660E | \n\u53C2\u6570 | \n
---|---|---|
label | \n\u81EA\u5B9A\u4E49\u8F93\u5165\u6846\u5DE6\u4FA7\u6587\u672C | \n- | \n
input | \n\u81EA\u5B9A\u4E49\u8F93\u5165\u6846\uFF0C\u4F7F\u7528\u6B64\u63D2\u69FD\u540E\uFF0C\u4E0E\u8F93\u5165\u6846\u76F8\u5173\u7684\u5C5E\u6027\u548C\u4E8B\u4EF6\u5C06\u5931\u6548 | \n- | \n
left-icon | \n\u81EA\u5B9A\u4E49\u8F93\u5165\u6846\u5934\u90E8\u56FE\u6807 | \n- | \n
right-icon | \n\u81EA\u5B9A\u4E49\u8F93\u5165\u6846\u5C3E\u90E8\u56FE\u6807 | \n- | \n
button | \n\u81EA\u5B9A\u4E49\u8F93\u5165\u6846\u5C3E\u90E8\u6309\u94AE | \n- | \n
error-message | \n\u81EA\u5B9A\u4E49\u5E95\u90E8\u9519\u8BEF\u63D0\u793A\u6587\u6848 | \n{ message: string } | \n
extra | \n\u81EA\u5B9A\u4E49\u8F93\u5165\u6846\u6700\u53F3\u4FA7\u7684\u989D\u5916\u5185\u5BB9 | \n- | \n
\u7EC4\u4EF6\u63D0\u4F9B\u4E86\u4E0B\u5217 CSS \u53D8\u91CF\uFF0C\u53EF\u7528\u4E8E\u81EA\u5B9A\u4E49\u6837\u5F0F\uFF0C\u4F7F\u7528\u65B9\u6CD5\u8BF7\u53C2\u8003 ConfigProvider \u7EC4\u4EF6\u3002
\n\u540D\u79F0 | \n\u9ED8\u8BA4\u503C | \n\u63CF\u8FF0 | \n
---|---|---|
--van-field-label-width | \n6.2em | \n- | \n
--van-field-label-color | \nvar(--van-text-color) | \n- | \n
--van-field-label-margin-right | \nvar(--van-padding-sm) | \n- | \n
--van-field-input-text-color | \nvar(--van-text-color) | \n- | \n
--van-field-input-error-text-color | \nvar(--van-danger-color) | \n- | \n
--van-field-input-disabled-text-color | \nvar(--van-text-color-3) | \n- | \n
--van-field-placeholder-text-color | \nvar(--van-text-color-3) | \n- | \n
--van-field-icon-size | \n18px | \n- | \n
--van-field-clear-icon-size | \n18px | \n- | \n
--van-field-clear-icon-color | \nvar(--van-gray-5) | \n- | \n
--van-field-right-icon-color | \nvar(--van-gray-6) | \n- | \n
--van-field-error-message-color | \nvar(--van-danger-color) | \n- | \n
--van-field-error-message-font-size | \n12px | \n- | \n
--van-field-text-area-min-height | \n60px | \n- | \n
--van-field-word-limit-color | \nvar(--van-gray-7) | \n- | \n
--van-field-word-limit-font-size | \nvar(--van-font-size-sm) | \n- | \n
--van-field-word-limit-line-height | \n16px | \n- | \n
--van-field-disabled-text-color | \nvar(--van-text-color-3) | \n- | \n
--van-field-required-mark-color | \nvar(--van-red) | \n- | \n
HTML \u539F\u751F\u7684 type="number"
\u5C5E\u6027\u5728 iOS \u548C Android \u7CFB\u7EDF\u4E0A\u90FD\u5B58\u5728\u4E00\u5B9A\u95EE\u9898\uFF0C\u6BD4\u5982 maxlength \u5C5E\u6027\u4E0D\u751F\u6548\u3001\u65E0\u6CD5\u83B7\u53D6\u5230\u5B8C\u6574\u7684\u8F93\u5165\u5185\u5BB9\u7B49\u3002\u56E0\u6B64\u8BBE\u7F6E type \u4E3A number
\u65F6\uFF0CField \u4E0D\u4F1A\u4F7F\u7528\u539F\u751F\u7684 type="number"
\u5C5E\u6027\uFF0C\u800C\u662F\u7528\u73B0\u4EE3\u6D4F\u89C8\u5668\u652F\u6301\u7684 inputmode \u5C5E\u6027\u6765\u63A7\u5236\u8F93\u5165\u952E\u76D8\u7684\u7C7B\u578B\u3002
Field \u7EC4\u4EF6\u5185\u90E8\u4F1A\u5C06\u4F20\u5165\u7684 v-model \u683C\u5F0F\u5316\u4E3A string \u7C7B\u578B\uFF0C\u4FBF\u4E8E\u7EC4\u4EF6\u5185\u90E8\u8FDB\u884C\u5904\u7406\u3002
\n\u5982\u679C\u4F60\u5E0C\u671B\u5728 v-model \u4E0A\u7ED1\u5B9A number \u7C7B\u578B\uFF0C\u53EF\u4EE5\u4F7F\u7528 Vue \u63D0\u4F9B\u7684 .number \u4FEE\u9970\u7B26\u3002
\n<van-field v-model.number="value" type="tel" />\n
\n\u6E05\u9664\u6309\u94AE\u76D1\u542C\u662F\u7684\u79FB\u52A8\u7AEF Touch \u4E8B\u4EF6\uFF0C\u53C2\u89C1\u684C\u9762\u7AEF\u9002\u914D\u3002
\n