/*! 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:'
\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\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 { Stepper } from 'vant';\n\nconst app = createApp();\napp.use(Stepper);\n
\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
<van-stepper v-model="value" />\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const value = ref(1);\n return { value };\n },\n};\n
\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
<van-stepper v-model="value" step="2" />\n
\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
<van-stepper v-model="value" min="5" max="8" />\n
\n\u8BBE\u7F6E integer
\u5C5E\u6027\u540E\uFF0C\u8F93\u5165\u6846\u5C06\u9650\u5236\u53EA\u80FD\u8F93\u5165\u6574\u6570\u3002
<van-stepper v-model="value" integer />\n
\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
<van-stepper v-model="value" disabled />\n
\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
<van-stepper v-model="value" disable-input />\n
\n\u901A\u8FC7\u8BBE\u7F6E decimal-length
\u5C5E\u6027\u53EF\u4EE5\u4FDD\u7559\u56FA\u5B9A\u7684\u5C0F\u6570\u4F4D\u6570\u3002
<van-stepper v-model="value" step="0.2" :decimal-length="1" />\n
\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
<van-stepper v-model="value" input-width="40px" button-size="32px" />\n
\n\u901A\u8FC7 before-change
\u5C5E\u6027\u53EF\u4EE5\u5728\u8F93\u5165\u503C\u53D8\u5316\u524D\u8FDB\u884C\u6821\u9A8C\u548C\u62E6\u622A\u3002
<van-stepper v-model="value" :before-change="beforeChange" />\n
\nimport { 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\u5C06 theme
\u8BBE\u7F6E\u4E3A round
\u6765\u5C55\u793A\u5706\u89D2\u98CE\u683C\u7684\u6B65\u8FDB\u5668\u3002
<van-stepper v-model="value" theme="round" button-size="22" disable-input />\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
min | \n\u6700\u5C0F\u503C | \nnumber | string | \n1 | \n
max | \n\u6700\u5927\u503C | \nnumber | string | \n- | \n
auto-fixed | \n\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\u6B63 | \nboolean | \ntrue | \n
default-value | \n\u521D\u59CB\u503C\uFF0C\u5F53 v-model \u4E3A\u7A7A\u65F6\u751F\u6548 | \nnumber | string | \n1 | \n
step | \n\u6B65\u957F\uFF0C\u6BCF\u6B21\u70B9\u51FB\u65F6\u6539\u53D8\u7684\u503C | \nnumber | string | \n1 | \n
name | \n\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\u53D6 | \nnumber | string | \n- | \n
input-width | \n\u8F93\u5165\u6846\u5BBD\u5EA6\uFF0C\u9ED8\u8BA4\u5355\u4F4D\u4E3A px | \nnumber | string | \n32px | \n
button-size | \n\u6309\u94AE\u5927\u5C0F\u4EE5\u53CA\u8F93\u5165\u6846\u9AD8\u5EA6\uFF0C\u9ED8\u8BA4\u5355\u4F4D\u4E3A px | \nnumber | string | \n28px | \n
decimal-length | \n\u56FA\u5B9A\u663E\u793A\u7684\u5C0F\u6570\u4F4D\u6570 | \nnumber | string | \n- | \n
theme | \n\u6837\u5F0F\u98CE\u683C\uFF0C\u53EF\u9009\u503C\u4E3A round | \nstring | \n- | \n
placeholder | \n\u8F93\u5165\u6846\u5360\u4F4D\u63D0\u793A\u6587\u5B57 | \nstring | \n- | \n
integer | \n\u662F\u5426\u53EA\u5141\u8BB8\u8F93\u5165\u6574\u6570 | \nboolean | \nfalse | \n
disabled | \n\u662F\u5426\u7981\u7528\u6B65\u8FDB\u5668 | \nboolean | \nfalse | \n
disable-plus | \n\u662F\u5426\u7981\u7528\u589E\u52A0\u6309\u94AE | \nboolean | \nfalse | \n
disable-minus | \n\u662F\u5426\u7981\u7528\u51CF\u5C11\u6309\u94AE | \nboolean | \nfalse | \n
disable-input | \n\u662F\u5426\u7981\u7528\u8F93\u5165\u6846 | \nboolean | \nfalse | \n
before-change | \n\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 | \n(value: number | string) => boolean | Promise<boolean> | \nfalse | \n
show-plus | \n\u662F\u5426\u663E\u793A\u589E\u52A0\u6309\u94AE | \nboolean | \ntrue | \n
show-minus | \n\u662F\u5426\u663E\u793A\u51CF\u5C11\u6309\u94AE | \nboolean | \ntrue | \n
show-input | \n\u662F\u5426\u663E\u793A\u8F93\u5165\u6846 | \nboolean | \ntrue | \n
long-press | \n\u662F\u5426\u5F00\u542F\u957F\u6309\u624B\u52BF\uFF0C\u5F00\u542F\u540E\u53EF\u4EE5\u957F\u6309\u589E\u52A0\u548C\u51CF\u5C11\u6309\u94AE | \nboolean | \ntrue | \n
allow-empty | \n\u662F\u5426\u5141\u8BB8\u8F93\u5165\u7684\u503C\u4E3A\u7A7A\uFF0C\u8BBE\u7F6E\u4E3A true \u540E\u5141\u8BB8\u4F20\u5165\u7A7A\u5B57\u7B26\u4E32 | \nboolean | \nfalse | \n
\u4E8B\u4EF6\u540D | \n\u8BF4\u660E | \n\u56DE\u8C03\u53C2\u6570 | \n
---|---|---|
change | \n\u5F53\u7ED1\u5B9A\u503C\u53D8\u5316\u65F6\u89E6\u53D1\u7684\u4E8B\u4EF6 | \nvalue: string, detail: { name: string } | \n
overlimit | \n\u70B9\u51FB\u4E0D\u53EF\u7528\u7684\u6309\u94AE\u65F6\u89E6\u53D1 | \n- | \n
plus | \n\u70B9\u51FB\u589E\u52A0\u6309\u94AE\u65F6\u89E6\u53D1 | \n- | \n
minus | \n\u70B9\u51FB\u51CF\u5C11\u6309\u94AE\u65F6\u89E6\u53D1 | \n- | \n
focus | \n\u8F93\u5165\u6846\u805A\u7126\u65F6\u89E6\u53D1 | \nevent: Event | \n
blur | \n\u8F93\u5165\u6846\u5931\u7126\u65F6\u89E6\u53D1 | \nevent: Event | \n
\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A
\nimport type { StepperTheme, StepperProps } from 'vant';\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-stepper-background | \nvar(--van-active-color) | \n- | \n
--van-stepper-button-icon-color | \nvar(--van-text-color) | \n- | \n
--van-stepper-button-disabled-color | \nvar(--van-background) | \n- | \n
--van-stepper-button-disabled-icon-color | \nvar(--van-gray-5) | \n- | \n
--van-stepper-button-round-theme-color | \nvar(--van-primary-color) | \n- | \n
--van-stepper-input-width | \n32px | \n- | \n
--van-stepper-input-height | \n28px | \n- | \n
--van-stepper-input-font-size | \nvar(--van-font-size-md) | \n- | \n
--van-stepper-input-line-height | \nnormal | \n- | \n
--van-stepper-input-text-color | \nvar(--van-text-color) | \n- | \n
--van-stepper-input-disabled-text-color | \nvar(--van-text-color-3) | \n- | \n
--van-stepper-input-disabled-background | \nvar(--van-active-color) | \n- | \n
--van-stepper-radius | \nvar(--van-radius-md) | \n- | \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
\u5982\u679C\u5E0C\u671B value \u4FDD\u6301 number \u7C7B\u578B\uFF0C\u53EF\u4EE5\u5728 v-model \u4E0A\u6DFB\u52A0 number
\u4FEE\u9970\u7B26\uFF1A
<van-stepper v-model.number="value" />\n
\n