/*! For license information please see 5211.a8ebed25.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["5211"],{7149:function(n,s,t){"use strict";t.r(s);var a=t("80681");let e=["innerHTML"];s.default={setup:()=>({html:""}),render:()=>((0,a.wg)(),(0,a.iD)("div",{class:"van-doc-markdown-body",innerHTML:'
\u5E95\u90E8\u5F39\u8D77\u7684\u6A21\u6001\u9762\u677F\uFF0C\u5305\u542B\u4E0E\u5F53\u524D\u60C5\u5883\u76F8\u5173\u7684\u591A\u4E2A\u9009\u9879\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 { ActionSheet } from 'vant';\n\nconst app = createApp();\napp.use(ActionSheet);\n
\n\u52A8\u4F5C\u9762\u677F\u901A\u8FC7 actions
\u5C5E\u6027\u6765\u5B9A\u4E49\u9009\u9879\uFF0Cactions
\u5C5E\u6027\u662F\u4E00\u4E2A\u7531\u5BF9\u8C61\u6784\u6210\u7684\u6570\u7EC4\uFF0C\u6570\u7EC4\u4E2D\u7684\u6BCF\u4E2A\u5BF9\u8C61\u914D\u7F6E\u4E00\u5217\uFF0C\u5BF9\u8C61\u683C\u5F0F\u89C1\u6587\u6863\u4E0B\u65B9\u8868\u683C\u3002
<van-cell is-link title="\u57FA\u7840\u7528\u6CD5" @click="show = true" />\n<van-action-sheet v-model:show="show" :actions="actions" @select="onSelect" />\n
\nimport { ref } from 'vue';\nimport { showToast } from 'vant';\n\nexport default {\n setup() {\n const show = ref(false);\n const actions = [\n { name: '\u9009\u9879\u4E00' },\n { name: '\u9009\u9879\u4E8C' },\n { name: '\u9009\u9879\u4E09' },\n ];\n const onSelect = (item) => {\n // \u9ED8\u8BA4\u60C5\u51B5\u4E0B\u70B9\u51FB\u9009\u9879\u65F6\u4E0D\u4F1A\u81EA\u52A8\u6536\u8D77\n // \u53EF\u4EE5\u901A\u8FC7 close-on-click-action \u5C5E\u6027\u5F00\u542F\u81EA\u52A8\u6536\u8D77\n show.value = false;\n showToast(item.name);\n };\n\n return {\n show,\n actions,\n onSelect,\n };\n },\n};\n
\n\u4F7F\u7528 actions
\u7684 icon
\u5B57\u6BB5\u53EF\u4EE5\u4E3A\u9009\u9879\u8BBE\u7F6E\u56FE\u6807\u3002
<van-cell is-link title="\u5C55\u793A\u56FE\u6807" @click="show = true" />\n<van-action-sheet v-model:show="show" :actions="actions" @select="onSelect" />\n
\nimport { ref } from 'vue';\nimport { showToast } from 'vant';\n\nexport default {\n setup() {\n const show = ref(false);\n const actions = [\n { name: '\u9009\u9879\u4E00', icon: 'cart-o' },\n { name: '\u9009\u9879\u4E8C', icon: 'shop-o' },\n { name: '\u9009\u9879\u4E09', icon: 'star-o' },\n ];\n const onSelect = (item) => {\n show.value = false;\n showToast(item.name);\n };\n\n return {\n show,\n actions,\n onSelect,\n };\n },\n};\n
\n\u8BBE\u7F6E cancel-text
\u5C5E\u6027\u540E\uFF0C\u4F1A\u5728\u5E95\u90E8\u5C55\u793A\u53D6\u6D88\u6309\u94AE\uFF0C\u70B9\u51FB\u540E\u5173\u95ED\u5F53\u524D\u9762\u677F\u5E76\u89E6\u53D1 cancel
\u4E8B\u4EF6\u3002
<van-action-sheet\n v-model:show="show"\n :actions="actions"\n cancel-text="\u53D6\u6D88"\n close-on-click-action\n @cancel="onCancel"\n/>\n
\nimport { ref } from 'vue';\nimport { showToast } from 'vant';\n\nexport default {\n setup() {\n const show = ref(false);\n const actions = [\n { name: '\u9009\u9879\u4E00' },\n { name: '\u9009\u9879\u4E8C' },\n { name: '\u9009\u9879\u4E09' },\n ];\n const onCancel = () => showToast('\u53D6\u6D88');\n\n return {\n show,\n actions,\n onCancel,\n };\n },\n};\n
\n\u901A\u8FC7 description
\u53EF\u4EE5\u5728\u83DC\u5355\u9876\u90E8\u663E\u793A\u63CF\u8FF0\u4FE1\u606F\uFF0C\u901A\u8FC7\u9009\u9879\u7684 subname
\u5C5E\u6027\u53EF\u4EE5\u5728\u9009\u9879\u6587\u5B57\u7684\u53F3\u4FA7\u5C55\u793A\u63CF\u8FF0\u4FE1\u606F\u3002
<van-action-sheet\n v-model:show="show"\n :actions="actions"\n cancel-text="\u53D6\u6D88"\n description="\u8FD9\u662F\u4E00\u6BB5\u63CF\u8FF0\u4FE1\u606F"\n close-on-click-action\n/>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const show = ref(false);\n const actions = [\n { name: '\u9009\u9879\u4E00' },\n { name: '\u9009\u9879\u4E8C' },\n { name: '\u9009\u9879\u4E09', subname: '\u63CF\u8FF0\u4FE1\u606F' },\n ];\n\n return {\n show,\n actions,\n };\n },\n};\n
\n\u53EF\u4EE5\u901A\u8FC7 loading
\u548C disabled
\u5C06\u9009\u9879\u8BBE\u7F6E\u4E3A\u52A0\u8F7D\u72B6\u6001\u6216\u7981\u7528\u72B6\u6001\uFF0C\u6216\u8005\u901A\u8FC7color
\u8BBE\u7F6E\u9009\u9879\u7684\u989C\u8272
<van-action-sheet\n v-model:show="show"\n :actions="actions"\n cancel-text="\u53D6\u6D88"\n close-on-click-action\n/>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const show = ref(false);\n const actions = [\n { name: '\u7740\u8272\u9009\u9879', color: '#ee0a24' },\n { name: '\u7981\u7528\u9009\u9879', disabled: true },\n { name: '\u52A0\u8F7D\u9009\u9879', loading: true },\n ];\n\n return {\n show,\n actions,\n };\n },\n};\n
\n\u901A\u8FC7\u63D2\u69FD\u53EF\u4EE5\u81EA\u5B9A\u4E49\u9762\u677F\u7684\u5C55\u793A\u5185\u5BB9\uFF0C\u540C\u65F6\u53EF\u4EE5\u4F7F\u7528title
\u5C5E\u6027\u5C55\u793A\u6807\u9898\u680F
<van-action-sheet v-model:show="show" title="\u6807\u9898">\n <div class="content">\u5185\u5BB9</div>\n</van-action-sheet>\n\n<style>\n .content {\n padding: 16px 16px 160px;\n }\n</style>\n
\n\u53C2\u6570 | \n\u8BF4\u660E | \n\u7C7B\u578B | \n\u9ED8\u8BA4\u503C | \n
---|---|---|---|
v-model:show | \n\u662F\u5426\u663E\u793A\u52A8\u4F5C\u9762\u677F | \nboolean | \nfalse | \n
actions | \n\u9762\u677F\u9009\u9879\u5217\u8868 | \nActionSheetAction[] | \n[] | \n
title | \n\u9876\u90E8\u6807\u9898 | \nstring | \n- | \n
cancel-text | \n\u53D6\u6D88\u6309\u94AE\u6587\u5B57 | \nstring | \n- | \n
description | \n\u9009\u9879\u4E0A\u65B9\u7684\u63CF\u8FF0\u4FE1\u606F | \nstring | \n- | \n
closeable | \n\u662F\u5426\u663E\u793A\u5173\u95ED\u56FE\u6807 | \nboolean | \ntrue | \n
close-icon | \n\u5173\u95ED\u56FE\u6807\u540D\u79F0\u6216\u56FE\u7247\u94FE\u63A5\uFF0C\u7B49\u540C\u4E8E Icon \u7EC4\u4EF6\u7684 name \u5C5E\u6027 | \nstring | \ncross | \n
duration | \n\u52A8\u753B\u65F6\u957F\uFF0C\u5355\u4F4D\u79D2\uFF0C\u8BBE\u7F6E\u4E3A 0 \u53EF\u4EE5\u7981\u7528\u52A8\u753B | \nnumber | string | \n0.3 | \n
z-index | \n\u5C06\u9762\u677F\u7684 z-index \u5C42\u7EA7\u8BBE\u7F6E\u4E3A\u4E00\u4E2A\u56FA\u5B9A\u503C | \nnumber | string | \n2000+ | \n
round | \n\u662F\u5426\u663E\u793A\u5706\u89D2 | \nboolean | \ntrue | \n
overlay | \n\u662F\u5426\u663E\u793A\u906E\u7F69\u5C42 | \nboolean | \ntrue | \n
overlay-class | \n\u81EA\u5B9A\u4E49\u906E\u7F69\u5C42\u7C7B\u540D | \nstring | Array | object | \n- | \n
overlay-style | \n\u81EA\u5B9A\u4E49\u906E\u7F69\u5C42\u6837\u5F0F | \nobject | \n- | \n
lock-scroll | \n\u662F\u5426\u9501\u5B9A\u80CC\u666F\u6EDA\u52A8 | \nboolean | \ntrue | \n
lazy-render | \n\u662F\u5426\u5728\u663E\u793A\u5F39\u5C42\u65F6\u624D\u6E32\u67D3\u8282\u70B9 | \nboolean | \ntrue | \n
close-on-popstate | \n\u662F\u5426\u5728\u9875\u9762\u56DE\u9000\u65F6\u81EA\u52A8\u5173\u95ED | \nboolean | \ntrue | \n
close-on-click-action | \n\u662F\u5426\u5728\u70B9\u51FB\u9009\u9879\u540E\u5173\u95ED | \nboolean | \nfalse | \n
close-on-click-overlay | \n\u662F\u5426\u5728\u70B9\u51FB\u906E\u7F69\u5C42\u540E\u5173\u95ED | \nboolean | \ntrue | \n
safe-area-inset-bottom | \n\u662F\u5426\u5F00\u542F\u5E95\u90E8\u5B89\u5168\u533A\u9002\u914D | \nboolean | \ntrue | \n
teleport | \n\u6307\u5B9A\u6302\u8F7D\u7684\u8282\u70B9\uFF0C\u7B49\u540C\u4E8E Teleport \u7EC4\u4EF6\u7684 to \u5C5E\u6027 | \nstring | Element | \n- | \n
before-close | \n\u5173\u95ED\u524D\u7684\u56DE\u8C03\u51FD\u6570\uFF0C\u8FD4\u56DE false \u53EF\u963B\u6B62\u5173\u95ED\uFF0C\u652F\u6301\u8FD4\u56DE Promise | \n(action: string) => boolean | Promise<boolean> | \n- | \n
actions
\u5C5E\u6027\u662F\u4E00\u4E2A\u7531\u5BF9\u8C61\u6784\u6210\u7684\u6570\u7EC4\uFF0C\u6570\u7EC4\u4E2D\u7684\u6BCF\u4E2A\u5BF9\u8C61\u914D\u7F6E\u4E00\u5217\uFF0C\u5BF9\u8C61\u53EF\u4EE5\u5305\u542B\u4EE5\u4E0B\u503C\uFF1A
\u952E\u540D | \n\u8BF4\u660E | \n\u7C7B\u578B | \n
---|---|---|
name | \n\u6807\u9898 | \nstring | \n
subname | \n\u4E8C\u7EA7\u6807\u9898 | \nstring | \n
color | \n\u9009\u9879\u6587\u5B57\u989C\u8272 | \nstring | \n
icon v4.8.6 | \n\u9009\u9879\u56FE\u6807\u540D\u79F0\u6216\u56FE\u7247\u94FE\u63A5 | \nstring | \n
className | \n\u4E3A\u5BF9\u5E94\u5217\u6DFB\u52A0\u989D\u5916\u7684 class | \nstring | Array | object | \n
loading | \n\u662F\u5426\u4E3A\u52A0\u8F7D\u72B6\u6001 | \nboolean | \n
disabled | \n\u662F\u5426\u4E3A\u7981\u7528\u72B6\u6001 | \nboolean | \n
callback | \n\u70B9\u51FB\u65F6\u89E6\u53D1\u7684\u56DE\u8C03\u51FD\u6570 | \naction: ActionSheetAction | \n
\u4E8B\u4EF6\u540D | \n\u8BF4\u660E | \n\u56DE\u8C03\u53C2\u6570 | \n
---|---|---|
select | \n\u70B9\u51FB\u9009\u9879\u65F6\u89E6\u53D1\uFF0C\u7981\u7528\u6216\u52A0\u8F7D\u72B6\u6001\u4E0B\u4E0D\u4F1A\u89E6\u53D1 | \naction: ActionSheetAction, index: number | \n
cancel | \n\u70B9\u51FB\u53D6\u6D88\u6309\u94AE\u65F6\u89E6\u53D1 | \n- | \n
open | \n\u6253\u5F00\u9762\u677F\u65F6\u89E6\u53D1 | \n- | \n
close | \n\u5173\u95ED\u9762\u677F\u65F6\u89E6\u53D1 | \n- | \n
opened | \n\u6253\u5F00\u9762\u677F\u4E14\u52A8\u753B\u7ED3\u675F\u540E\u89E6\u53D1 | \n- | \n
closed | \n\u5173\u95ED\u9762\u677F\u4E14\u52A8\u753B\u7ED3\u675F\u540E\u89E6\u53D1 | \n- | \n
click-overlay | \n\u70B9\u51FB\u906E\u7F69\u5C42\u65F6\u89E6\u53D1 | \nevent: MouseEvent | \n
\u540D\u79F0 | \n\u8BF4\u660E | \n\u53C2\u6570 | \n
---|---|---|
default | \n\u81EA\u5B9A\u4E49\u9762\u677F\u7684\u5C55\u793A\u5185\u5BB9 | \n- | \n
description | \n\u81EA\u5B9A\u4E49\u63CF\u8FF0\u6587\u6848 | \n- | \n
cancel | \n\u81EA\u5B9A\u4E49\u53D6\u6D88\u6309\u94AE\u5185\u5BB9 | \n- | \n
action | \n\u81EA\u5B9A\u4E49\u9009\u9879\u5185\u5BB9 | \n{ action: ActionSheetAction, index: number } | \n
\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A
\nimport type { ActionSheetProps, ActionSheetAction } 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-action-sheet-max-height | \n80% | \n- | \n
--van-action-sheet-header-height | \n48px | \n- | \n
--van-action-sheet-header-font-size | \nvar(--van-font-size-lg) | \n- | \n
--van-action-sheet-description-color | \nvar(--van-text-color-2) | \n- | \n
--van-action-sheet-description-font-size | \nvar(--van-font-size-md) | \n- | \n
--van-action-sheet-description-line-height | \nvar(--van-line-height-md) | \n- | \n
--van-action-sheet-item-background | \nvar(--van-background-2) | \n- | \n
--van-action-sheet-item-font-size | \nvar(--van-font-size-lg) | \n- | \n
--van-action-sheet-item-line-height | \nvar(--van-line-height-lg) | \n- | \n
--van-action-sheet-item-text-color | \nvar(--van-text-color) | \n- | \n
--van-action-sheet-item-disabled-text-color | \nvar(--van-text-color-3) | \n- | \n
--van-action-sheet-item-icon-size | \n18px | \n- | \n
--van-action-sheet-item-icon-margin-right | \nvar(--van-padding-xs) | \n- | \n
--van-action-sheet-subname-color | \nvar(--van-text-color-2) | \n- | \n
--van-action-sheet-subname-font-size | \nvar(--van-font-size-sm) | \n- | \n
--van-action-sheet-subname-line-height | \nvar(--van-line-height-sm) | \n- | \n
--van-action-sheet-close-icon-size | \n22px | \n- | \n
--van-action-sheet-close-icon-color | \nvar(--van-gray-5) | \n- | \n
--van-action-sheet-close-icon-padding | \n0 var(--van-padding-md) | \n- | \n
--van-action-sheet-cancel-text-color | \nvar(--van-gray-7) | \n- | \n
--van-action-sheet-cancel-padding-top | \nvar(--van-padding-xs) | \n- | \n
--van-action-sheet-cancel-padding-color | \nvar(--van-background) | \n- | \n
--van-action-sheet-loading-icon-size | \n22px | \n- | \n