/*! For license information please see 43.98605bac.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["43"],{78569: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:'

PasswordInput \u5BC6\u7801\u8F93\u5165\u6846

\n

\u4ECB\u7ECD

\n

\u5E26\u7F51\u683C\u7684\u8F93\u5165\u6846\u7EC4\u4EF6\uFF0C\u53EF\u4EE5\u7528\u4E8E\u8F93\u5165\u5BC6\u7801\u3001\u77ED\u4FE1\u9A8C\u8BC1\u7801\u7B49\u573A\u666F\uFF0C\u901A\u5E38\u4E0E\u6570\u5B57\u952E\u76D8\u7EC4\u4EF6\u914D\u5408\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 { PasswordInput, NumberKeyboard } from 'vant';\n\nconst app = createApp();\napp.use(PasswordInput);\napp.use(NumberKeyboard);\n
\n

\u4EE3\u7801\u6F14\u793A

\n

\u57FA\u7840\u7528\u6CD5

\n

\u642D\u914D\u6570\u5B57\u952E\u76D8\u7EC4\u4EF6\u6765\u5B9E\u73B0\u5BC6\u7801\u8F93\u5165\u529F\u80FD\u3002

\n
<!-- \u5BC6\u7801\u8F93\u5165\u6846 -->\n<van-password-input\n  :value="value"\n  :focused="showKeyboard"\n  @focus="showKeyboard = true"\n/>\n<!-- \u6570\u5B57\u952E\u76D8 -->\n<van-number-keyboard\n  v-model="value"\n  :show="showKeyboard"\n  @blur="showKeyboard = false"\n/>\n
\n
import { ref } from 'vue';\n\nexport default {\n  setup() {\n    const value = ref('123');\n    const showKeyboard = ref(true);\n\n    return {\n      value,\n      showKeyboard,\n    };\n  },\n};\n
\n

\u81EA\u5B9A\u4E49\u957F\u5EA6

\n

\u901A\u8FC7 length \u5C5E\u6027\u6765\u8BBE\u7F6E\u5BC6\u7801\u957F\u5EA6\u3002

\n
<van-password-input\n  :value="value"\n  :length="4"\n  :focused="showKeyboard"\n  @focus="showKeyboard = true"\n/>\n
\n

\u683C\u5B50\u95F4\u8DDD

\n

\u901A\u8FC7 gutter \u5C5E\u6027\u6765\u8BBE\u7F6E\u683C\u5B50\u4E4B\u95F4\u7684\u95F4\u8DDD\u3002

\n
<van-password-input\n  :value="value"\n  :gutter="10"\n  :focused="showKeyboard"\n  @focus="showKeyboard = true"\n/>\n
\n

\u660E\u6587\u5C55\u793A

\n

\u5C06 mask \u8BBE\u7F6E\u4E3A false \u53EF\u4EE5\u660E\u6587\u5C55\u793A\u8F93\u5165\u7684\u5185\u5BB9\uFF0C\u9002\u7528\u4E8E\u77ED\u4FE1\u9A8C\u8BC1\u7801\u7B49\u573A\u666F\u3002

\n
<van-password-input\n  :value="value"\n  :mask="false"\n  :focused="showKeyboard"\n  @focus="showKeyboard = true"\n/>\n
\n

\u63D0\u793A\u4FE1\u606F

\n

\u901A\u8FC7 info \u5C5E\u6027\u8BBE\u7F6E\u63D0\u793A\u4FE1\u606F\uFF0C\u901A\u8FC7 error-info \u5C5E\u6027\u8BBE\u7F6E\u9519\u8BEF\u63D0\u793A\uFF0C\u4F8B\u5982\u5F53\u8F93\u5165\u516D\u4F4D\u65F6\u63D0\u793A\u5BC6\u7801\u9519\u8BEF\u3002

\n
<van-password-input\n  :value="value"\n  info="\u5BC6\u7801\u4E3A 6 \u4F4D\u6570\u5B57"\n  :error-info="errorInfo"\n  :focused="showKeyboard"\n  @focus="showKeyboard = true"\n/>\n<van-number-keyboard\n  v-model="value"\n  :show="showKeyboard"\n  @blur="showKeyboard = false"\n/>\n
\n
import { ref, watch } from 'vue';\n\nexport default {\n  setup() {\n    const value = ref('123');\n    const errorInfo = ref('');\n    const showKeyboard = ref(true);\n\n    watch(value, (newVal) => {\n      if (newVal.length === 6 && newVal !== '123456') {\n        errorInfo.value = '\u5BC6\u7801\u9519\u8BEF';\n      } else {\n        errorInfo.value = '';\n      }\n    });\n\n    return {\n      value,\n      errorInfo,\n      showKeyboard,\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
\u53C2\u6570\u8BF4\u660E\u7C7B\u578B\u9ED8\u8BA4\u503C
value\u5BC6\u7801\u503Cstring\'\'
info\u8F93\u5165\u6846\u4E0B\u65B9\u6587\u5B57\u63D0\u793Astring-
error-info\u8F93\u5165\u6846\u4E0B\u65B9\u9519\u8BEF\u63D0\u793Astring-
length\u5BC6\u7801\u6700\u5927\u957F\u5EA6number | string6
gutter\u8F93\u5165\u6846\u683C\u5B50\u4E4B\u95F4\u7684\u95F4\u8DDD\uFF0C\u5982 20px 2em\uFF0C\u9ED8\u8BA4\u5355\u4F4D\u4E3Apxnumber | string0
mask\u662F\u5426\u9690\u85CF\u5BC6\u7801\u5185\u5BB9booleantrue
focused\u662F\u5426\u5DF2\u805A\u7126\uFF0C\u805A\u7126\u65F6\u4F1A\u663E\u793A\u5149\u6807booleanfalse
\n

Events

\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
focus\u8F93\u5165\u6846\u805A\u7126\u65F6\u89E6\u53D1-
\n

\u7C7B\u578B\u5B9A\u4E49

\n

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

\n
import type { PasswordInputProps } from 'vant';\n
\n

\u4E3B\u9898\u5B9A\u5236

\n

\u6837\u5F0F\u53D8\u91CF

\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\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
\u540D\u79F0\u9ED8\u8BA4\u503C\u63CF\u8FF0
--van-password-input-height50px-
--van-password-input-margin0 var(--van-padding-md)-
--van-password-input-font-size20px-
--van-password-input-radius6px-
--van-password-input-backgroundvar(--van-background-2)-
--van-password-input-info-colorvar(--van-text-color-2)-
--van-password-input-info-font-sizevar(--van-font-size-md)-
--van-password-input-error-info-colorvar(--van-danger-color)-
--van-password-input-dot-size10px-
--van-password-input-dot-colorvar(--van-text-color)-
--van-password-input-text-colorvar(--van-text-color)-
--van-password-input-cursor-colorvar(--van-text-color)-
--van-password-input-cursor-width1px-
--van-password-input-cursor-height40%-
--van-password-input-cursor-duration1s-
\n
'},null,8,l))}}}]);