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

Stepper \u6B65\u8FDB\u5668

\n

\u4ECB\u7ECD

\n

\u6B65\u8FDB\u5668\u7531\u589E\u52A0\u6309\u94AE\u3001\u51CF\u5C11\u6309\u94AE\u548C\u8F93\u5165\u6846\u7EC4\u6210\uFF0C\u7528\u4E8E\u5728\u4E00\u5B9A\u8303\u56F4\u5185\u8F93\u5165\u3001\u8C03\u6574\u6570\u5B57\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 { Stepper } from 'vant';\n\nconst app = createApp();\napp.use(Stepper);\n
\n

\u4EE3\u7801\u6F14\u793A

\n

\u57FA\u7840\u7528\u6CD5

\n

\u901A\u8FC7 v-model \u7ED1\u5B9A\u8F93\u5165\u503C\uFF0C\u53EF\u4EE5\u901A\u8FC7 change \u4E8B\u4EF6\u76D1\u542C\u5230\u8F93\u5165\u503C\u7684\u53D8\u5316\u3002

\n
<van-stepper v-model="value" />\n
\n
import { ref } from 'vue';\n\nexport default {\n  setup() {\n    const value = ref(1);\n    return { value };\n  },\n};\n
\n

\u6B65\u957F\u8BBE\u7F6E

\n

\u901A\u8FC7 step \u5C5E\u6027\u8BBE\u7F6E\u6BCF\u6B21\u70B9\u51FB\u589E\u52A0\u6216\u51CF\u5C11\u6309\u94AE\u65F6\u53D8\u5316\u7684\u503C\uFF0C\u9ED8\u8BA4\u4E3A 1\u3002

\n
<van-stepper v-model="value" step="2" />\n
\n

\u9650\u5236\u8F93\u5165\u8303\u56F4

\n

\u901A\u8FC7 min \u548C max \u5C5E\u6027\u9650\u5236\u8F93\u5165\u503C\u7684\u8303\u56F4\uFF0C\u9ED8\u8BA4\u8D85\u51FA\u8303\u56F4\u540E\u4F1A\u81EA\u52A8\u6821\u6B63\u6700\u5927\u503C\u6216\u6700\u5C0F\u503C\uFF0C\u901A\u8FC7 auto-fixed \u53EF\u4EE5\u5173\u95ED\u81EA\u52A8\u6821\u6B63\u3002

\n
<van-stepper v-model="value" min="5" max="8" />\n
\n

\u9650\u5236\u8F93\u5165\u6574\u6570

\n

\u8BBE\u7F6E integer \u5C5E\u6027\u540E\uFF0C\u8F93\u5165\u6846\u5C06\u9650\u5236\u53EA\u80FD\u8F93\u5165\u6574\u6570\u3002

\n
<van-stepper v-model="value" integer />\n
\n

\u7981\u7528\u72B6\u6001

\n

\u901A\u8FC7\u8BBE\u7F6E disabled \u5C5E\u6027\u6765\u7981\u7528\u6B65\u8FDB\u5668\uFF0C\u7981\u7528\u72B6\u6001\u4E0B\u65E0\u6CD5\u70B9\u51FB\u6309\u94AE\u6216\u4FEE\u6539\u8F93\u5165\u6846\u3002

\n
<van-stepper v-model="value" disabled />\n
\n

\u7981\u7528\u8F93\u5165\u6846

\n

\u901A\u8FC7\u8BBE\u7F6E disable-input \u5C5E\u6027\u6765\u7981\u7528\u8F93\u5165\u6846\uFF0C\u6B64\u65F6\u6309\u94AE\u4ECD\u7136\u53EF\u4EE5\u70B9\u51FB\u3002

\n
<van-stepper v-model="value" disable-input />\n
\n

\u56FA\u5B9A\u5C0F\u6570\u4F4D\u6570

\n

\u901A\u8FC7\u8BBE\u7F6E decimal-length \u5C5E\u6027\u53EF\u4EE5\u4FDD\u7559\u56FA\u5B9A\u7684\u5C0F\u6570\u4F4D\u6570\u3002

\n
<van-stepper v-model="value" step="0.2" :decimal-length="1" />\n
\n

\u81EA\u5B9A\u4E49\u5927\u5C0F

\n

\u901A\u8FC7 input-width \u5C5E\u6027\u8BBE\u7F6E\u8F93\u5165\u6846\u5BBD\u5EA6\uFF0C\u901A\u8FC7 button-size \u5C5E\u6027\u8BBE\u7F6E\u6309\u94AE\u5927\u5C0F\u548C\u8F93\u5165\u6846\u9AD8\u5EA6\u3002

\n
<van-stepper v-model="value" input-width="40px" button-size="32px" />\n
\n

\u5F02\u6B65\u53D8\u66F4

\n

\u901A\u8FC7 before-change \u5C5E\u6027\u53EF\u4EE5\u5728\u8F93\u5165\u503C\u53D8\u5316\u524D\u8FDB\u884C\u6821\u9A8C\u548C\u62E6\u622A\u3002

\n
<van-stepper v-model="value" :before-change="beforeChange" />\n
\n
import { ref } from 'vue';\nimport { closeToast, showLoadingToast } from 'vant';\n\nexport default {\n  setup() {\n    const value = ref(1);\n\n    const beforeChange = (value) => {\n      showLoadingToast({ forbidClick: true });\n\n      return new Promise((resolve) => {\n        setTimeout(() => {\n          closeToast();\n          // \u5728 resolve \u51FD\u6570\u4E2D\u8FD4\u56DE true \u6216 false\n          resolve(true);\n        }, 500);\n      });\n    };\n\n    return {\n      value,\n      beforeChange,\n    };\n  },\n};\n
\n

\u5706\u89D2\u98CE\u683C

\n

\u5C06 theme \u8BBE\u7F6E\u4E3A round \u6765\u5C55\u793A\u5706\u89D2\u98CE\u683C\u7684\u6B65\u8FDB\u5668\u3002

\n
<van-stepper v-model="value" theme="round" button-size="22" disable-input />\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\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
v-model\u5F53\u524D\u8F93\u5165\u7684\u503Cnumber | string-
min\u6700\u5C0F\u503Cnumber | string1
max\u6700\u5927\u503Cnumber | string-
auto-fixed\u662F\u5426\u81EA\u52A8\u6821\u6B63\u8D85\u51FA\u9650\u5236\u8303\u56F4\u7684\u6570\u503C\uFF0C\u8BBE\u7F6E\u4E3A false \u540E\u8F93\u5165\u8D85\u8FC7\u9650\u5236\u8303\u56F4\u7684\u6570\u503C\u5C06\u4E0D\u4F1A\u81EA\u52A8\u6821\u6B63booleantrue
default-value\u521D\u59CB\u503C\uFF0C\u5F53 v-model \u4E3A\u7A7A\u65F6\u751F\u6548number | string1
step\u6B65\u957F\uFF0C\u6BCF\u6B21\u70B9\u51FB\u65F6\u6539\u53D8\u7684\u503Cnumber | string1
name\u6807\u8BC6\u7B26\uFF0C\u901A\u5E38\u4E3A\u4E00\u4E2A\u552F\u4E00\u7684\u5B57\u7B26\u4E32\u6216\u6570\u5B57\uFF0C\u53EF\u4EE5\u5728 change \u4E8B\u4EF6\u56DE\u8C03\u53C2\u6570\u4E2D\u83B7\u53D6number | string-
input-width\u8F93\u5165\u6846\u5BBD\u5EA6\uFF0C\u9ED8\u8BA4\u5355\u4F4D\u4E3A pxnumber | string32px
button-size\u6309\u94AE\u5927\u5C0F\u4EE5\u53CA\u8F93\u5165\u6846\u9AD8\u5EA6\uFF0C\u9ED8\u8BA4\u5355\u4F4D\u4E3A pxnumber | string28px
decimal-length\u56FA\u5B9A\u663E\u793A\u7684\u5C0F\u6570\u4F4D\u6570number | string-
theme\u6837\u5F0F\u98CE\u683C\uFF0C\u53EF\u9009\u503C\u4E3A roundstring-
placeholder\u8F93\u5165\u6846\u5360\u4F4D\u63D0\u793A\u6587\u5B57string-
integer\u662F\u5426\u53EA\u5141\u8BB8\u8F93\u5165\u6574\u6570booleanfalse
disabled\u662F\u5426\u7981\u7528\u6B65\u8FDB\u5668booleanfalse
disable-plus\u662F\u5426\u7981\u7528\u589E\u52A0\u6309\u94AEbooleanfalse
disable-minus\u662F\u5426\u7981\u7528\u51CF\u5C11\u6309\u94AEbooleanfalse
disable-input\u662F\u5426\u7981\u7528\u8F93\u5165\u6846booleanfalse
before-change\u8F93\u5165\u503C\u53D8\u5316\u524D\u7684\u56DE\u8C03\u51FD\u6570\uFF0C\u8FD4\u56DE false \u53EF\u963B\u6B62\u8F93\u5165\uFF0C\u652F\u6301\u8FD4\u56DE Promise(value: number | string) => boolean | Promise<boolean>false
show-plus\u662F\u5426\u663E\u793A\u589E\u52A0\u6309\u94AEbooleantrue
show-minus\u662F\u5426\u663E\u793A\u51CF\u5C11\u6309\u94AEbooleantrue
show-input\u662F\u5426\u663E\u793A\u8F93\u5165\u6846booleantrue
long-press\u662F\u5426\u5F00\u542F\u957F\u6309\u624B\u52BF\uFF0C\u5F00\u542F\u540E\u53EF\u4EE5\u957F\u6309\u589E\u52A0\u548C\u51CF\u5C11\u6309\u94AEbooleantrue
allow-empty\u662F\u5426\u5141\u8BB8\u8F93\u5165\u7684\u503C\u4E3A\u7A7A\uFF0C\u8BBE\u7F6E\u4E3A true \u540E\u5141\u8BB8\u4F20\u5165\u7A7A\u5B57\u7B26\u4E32booleanfalse
\n

Events

\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
\u4E8B\u4EF6\u540D\u8BF4\u660E\u56DE\u8C03\u53C2\u6570
change\u5F53\u7ED1\u5B9A\u503C\u53D8\u5316\u65F6\u89E6\u53D1\u7684\u4E8B\u4EF6value: string, detail: { name: string }
overlimit\u70B9\u51FB\u4E0D\u53EF\u7528\u7684\u6309\u94AE\u65F6\u89E6\u53D1-
plus\u70B9\u51FB\u589E\u52A0\u6309\u94AE\u65F6\u89E6\u53D1-
minus\u70B9\u51FB\u51CF\u5C11\u6309\u94AE\u65F6\u89E6\u53D1-
focus\u8F93\u5165\u6846\u805A\u7126\u65F6\u89E6\u53D1event: Event
blur\u8F93\u5165\u6846\u5931\u7126\u65F6\u89E6\u53D1event: Event
\n

\u7C7B\u578B\u5B9A\u4E49

\n

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

\n
import type { StepperTheme, StepperProps } 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
\u540D\u79F0\u9ED8\u8BA4\u503C\u63CF\u8FF0
--van-stepper-backgroundvar(--van-active-color)-
--van-stepper-button-icon-colorvar(--van-text-color)-
--van-stepper-button-disabled-colorvar(--van-background)-
--van-stepper-button-disabled-icon-colorvar(--van-gray-5)-
--van-stepper-button-round-theme-colorvar(--van-primary-color)-
--van-stepper-input-width32px-
--van-stepper-input-height28px-
--van-stepper-input-font-sizevar(--van-font-size-md)-
--van-stepper-input-line-heightnormal-
--van-stepper-input-text-colorvar(--van-text-color)-
--van-stepper-input-disabled-text-colorvar(--van-text-color-3)-
--van-stepper-input-disabled-backgroundvar(--van-active-color)-
--van-stepper-radiusvar(--van-radius-md)-
\n

\u5E38\u89C1\u95EE\u9898

\n

\u4E3A\u4EC0\u4E48 value \u6709\u65F6\u5019\u4F1A\u53D8\u6210 string \u7C7B\u578B\uFF1F

\n

\u8FD9\u662F\u56E0\u4E3A\u7528\u6237\u8F93\u5165\u8FC7\u7A0B\u4E2D\u53EF\u80FD\u51FA\u73B0\u5C0F\u6570\u70B9\u6216\u7A7A\u503C\uFF0C\u6BD4\u5982 1.\uFF0C\u8FD9\u79CD\u60C5\u51B5\u4E0B\u7EC4\u4EF6\u4F1A\u629B\u51FA\u5B57\u7B26\u4E32\u7C7B\u578B\u3002

\n

\u5982\u679C\u5E0C\u671B value \u4FDD\u6301 number \u7C7B\u578B\uFF0C\u53EF\u4EE5\u5728 v-model \u4E0A\u6DFB\u52A0 number \u4FEE\u9970\u7B26\uFF1A

\n
<van-stepper v-model.number="value" />\n
\n
'},null,8,d))}}}]);