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

Popup \u5F39\u51FA\u5C42

\n

\u4ECB\u7ECD

\n

\u5F39\u51FA\u5C42\u5BB9\u5668\uFF0C\u7528\u4E8E\u5C55\u793A\u5F39\u7A97\u3001\u4FE1\u606F\u63D0\u793A\u7B49\u5185\u5BB9\uFF0C\u652F\u6301\u591A\u4E2A\u5F39\u51FA\u5C42\u53E0\u52A0\u5C55\u793A\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 { Popup } from 'vant';\n\nconst app = createApp();\napp.use(Popup);\n
\n

\u4EE3\u7801\u6F14\u793A

\n

\u57FA\u7840\u7528\u6CD5

\n

\u901A\u8FC7 v-model:show \u63A7\u5236\u5F39\u51FA\u5C42\u662F\u5426\u5C55\u793A\u3002

\n
<van-cell title="\u5C55\u793A\u5F39\u51FA\u5C42" is-link @click="showPopup" />\n<van-popup v-model:show="show" :style="{ padding: '64px' }">\u5185\u5BB9</van-popup>\n
\n
import { ref } from 'vue';\n\nexport default {\n  setup() {\n    const show = ref(false);\n    const showPopup = () => {\n      show.value = true;\n    };\n    return {\n      show,\n      showPopup,\n    };\n  },\n};\n
\n

\u5F39\u51FA\u4F4D\u7F6E

\n

\u901A\u8FC7 position \u5C5E\u6027\u8BBE\u7F6E\u5F39\u7A97\u7684\u5F39\u51FA\u4F4D\u7F6E\uFF0C\u9ED8\u8BA4\u4E3A\u5C45\u4E2D\u5F39\u51FA\uFF0C\u53EF\u4EE5\u8BBE\u7F6E\u4E3A top\u3001bottom\u3001left\u3001right\u3002

\n\n
<!-- \u9876\u90E8\u5F39\u51FA -->\n<van-popup v-model:show="showTop" position="top" :style="{ height: '30%' }" />\n\n<!-- \u5E95\u90E8\u5F39\u51FA -->\n<van-popup\n  v-model:show="showBottom"\n  position="bottom"\n  :style="{ height: '30%' }"\n/>\n\n<!-- \u5DE6\u4FA7\u5F39\u51FA -->\n<van-popup\n  v-model:show="showLeft"\n  position="left"\n  :style="{ width: '30%', height: '100%' }"\n/>\n\n<!-- \u53F3\u4FA7\u5F39\u51FA -->\n<van-popup\n  v-model:show="showRight"\n  position="right"\n  :style="{ width: '30%', height: '100%' }"\n/>\n
\n

\u5173\u95ED\u56FE\u6807

\n

\u8BBE\u7F6E closeable \u5C5E\u6027\u540E\uFF0C\u4F1A\u5728\u5F39\u51FA\u5C42\u7684\u53F3\u4E0A\u89D2\u663E\u793A\u5173\u95ED\u56FE\u6807\uFF0C\u5E76\u4E14\u53EF\u4EE5\u901A\u8FC7 close-icon \u5C5E\u6027\u81EA\u5B9A\u4E49\u56FE\u6807\uFF0C\u4F7F\u7528 close-icon-position \u5C5E\u6027\u53EF\u4EE5\u81EA\u5B9A\u4E49\u56FE\u6807\u4F4D\u7F6E\u3002

\n
<van-popup\n  v-model:show="show"\n  closeable\n  position="bottom"\n  :style="{ height: '30%' }"\n/>\n<!-- \u81EA\u5B9A\u4E49\u56FE\u6807 -->\n<van-popup\n  v-model:show="show"\n  closeable\n  close-icon="close"\n  position="bottom"\n  :style="{ height: '30%' }"\n/>\n<!-- \u56FE\u6807\u4F4D\u7F6E -->\n<van-popup\n  v-model:show="show"\n  closeable\n  close-icon-position="top-left"\n  position="bottom"\n  :style="{ height: '30%' }"\n/>\n
\n

\u5706\u89D2\u5F39\u7A97

\n

\u8BBE\u7F6E round \u5C5E\u6027\u540E\uFF0C\u5F39\u7A97\u4F1A\u6839\u636E\u5F39\u51FA\u4F4D\u7F6E\u6DFB\u52A0\u4E0D\u540C\u7684\u5706\u89D2\u6837\u5F0F\u3002

\n
<!-- \u5706\u89D2\u5F39\u7A97\uFF08\u5C45\u4E2D\uFF09 -->\n<van-popup v-model:show="showCenter" round :style="{ padding: '64px' }" />\n\n<!-- \u5706\u89D2\u5F39\u7A97\uFF08\u5E95\u90E8\uFF09 -->\n<van-popup\n  v-model:show="showBottom"\n  round\n  position="bottom"\n  :style="{ height: '30%' }"\n/>\n
\n

\u76D1\u542C\u70B9\u51FB\u4E8B\u4EF6

\n

Popup \u652F\u6301\u4EE5\u4E0B\u70B9\u51FB\u4E8B\u4EF6\uFF1A

\n\n
<van-cell title="\u76D1\u542C\u70B9\u51FB\u4E8B\u4EF6" is-link @click="show = true" />\n<van-popup\n  v-model:show="show"\n  position="bottom"\n  :style="{ height: '30%' }"\n  closeable\n  @click-overlay="onClickOverlay"\n  @click-close-icon="onClickCloseIcon"\n/>\n
\n
import { ref } from 'vue';\nimport { showToast } from 'vant';\n\nexport default {\n  setup() {\n    const show = ref(false);\n    const onClickOverlay = () => {\n      showToast('click-overlay');\n    };\n    const onClickCloseIcon = () => {\n      showToast('click-close-icon');\n    };\n    return {\n      show,\n      onClickOverlay,\n      onClickCloseIcon,\n    };\n  },\n};\n
\n

\u76D1\u542C\u663E\u793A\u4E8B\u4EF6

\n

\u5F53 Popup \u88AB\u6253\u5F00\u6216\u5173\u95ED\u65F6\uFF0C\u4F1A\u89E6\u53D1\u4EE5\u4E0B\u4E8B\u4EF6\uFF1A

\n\n
<van-cell title="\u76D1\u542C\u663E\u793A\u4E8B\u4EF6" is-link @click="show = true" />\n<van-popup\n  v-model:show="show"\n  position="bottom"\n  :style="{ height: '30%' }"\n  @open="showToast('open')"\n  @opened="showToast('opened')"\n  @close="showToast('close')"\n  @closed="showToast('closed')"\n/>\n
\n
import { ref } from 'vue';\nimport { showToast } from 'vant';\n\nexport default {\n  setup() {\n    const show = ref(false);\n    return {\n      show,\n      showToast,\n    };\n  },\n};\n
\n

\u6307\u5B9A\u6302\u8F7D\u4F4D\u7F6E

\n

\u5F39\u51FA\u5C42\u9ED8\u8BA4\u6302\u8F7D\u5230\u7EC4\u4EF6\u6807\u7B7E\u6240\u5728\u4F4D\u7F6E\uFF0C\u53EF\u4EE5\u901A\u8FC7 teleport \u5C5E\u6027\u6307\u5B9A\u6302\u8F7D\u4F4D\u7F6E\u3002

\n
<!-- \u6302\u8F7D\u5230 body \u8282\u70B9\u4E0B -->\n<van-popup v-model:show="show" teleport="body" />\n\n<!-- \u6302\u8F7D\u5230 #app \u8282\u70B9\u4E0B -->\n<van-popup v-model:show="show" teleport="#app" />\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
\u53C2\u6570\u8BF4\u660E\u7C7B\u578B\u9ED8\u8BA4\u503C
v-model:show\u662F\u5426\u663E\u793A\u5F39\u51FA\u5C42booleanfalse
overlay\u662F\u5426\u663E\u793A\u906E\u7F69\u5C42booleantrue
position\u5F39\u51FA\u4F4D\u7F6E\uFF0C\u53EF\u9009\u503C\u4E3A top bottom right leftstringcenter
overlay-class\u81EA\u5B9A\u4E49\u906E\u7F69\u5C42\u7C7B\u540Dstring | Array | object-
overlay-style\u81EA\u5B9A\u4E49\u906E\u7F69\u5C42\u6837\u5F0Fobject-
duration\u52A8\u753B\u65F6\u957F\uFF0C\u5355\u4F4D\u79D2\uFF0C\u8BBE\u7F6E\u4E3A 0 \u53EF\u4EE5\u7981\u7528\u52A8\u753Bnumber | string0.3
z-index\u5C06\u5F39\u7A97\u7684 z-index \u5C42\u7EA7\u8BBE\u7F6E\u4E3A\u4E00\u4E2A\u56FA\u5B9A\u503Cnumber | string2000+
round\u662F\u5426\u663E\u793A\u5706\u89D2booleanfalse
lock-scroll\u662F\u5426\u9501\u5B9A\u80CC\u666F\u6EDA\u52A8booleantrue
lazy-render\u662F\u5426\u5728\u663E\u793A\u5F39\u5C42\u65F6\u624D\u6E32\u67D3\u8282\u70B9booleantrue
close-on-popstate\u662F\u5426\u5728\u9875\u9762\u56DE\u9000\u65F6\u81EA\u52A8\u5173\u95EDbooleanfalse
close-on-click-overlay\u662F\u5426\u5728\u70B9\u51FB\u906E\u7F69\u5C42\u540E\u5173\u95EDbooleantrue
closeable\u662F\u5426\u663E\u793A\u5173\u95ED\u56FE\u6807booleanfalse
close-icon\u5173\u95ED\u56FE\u6807\u540D\u79F0\u6216\u56FE\u7247\u94FE\u63A5\uFF0C\u7B49\u540C\u4E8E Icon \u7EC4\u4EF6\u7684 name \u5C5E\u6027stringcross
close-icon-position\u5173\u95ED\u56FE\u6807\u4F4D\u7F6E\uFF0C\u53EF\u9009\u503C\u4E3A top-left
bottom-left bottom-right
stringtop-right
before-close\u5173\u95ED\u524D\u7684\u56DE\u8C03\u51FD\u6570\uFF0C\u8FD4\u56DE false \u53EF\u963B\u6B62\u5173\u95ED\uFF0C\u652F\u6301\u8FD4\u56DE Promise(action: string) => boolean | Promise<boolean>-
icon-prefix\u56FE\u6807\u7C7B\u540D\u524D\u7F00\uFF0C\u7B49\u540C\u4E8E Icon \u7EC4\u4EF6\u7684 class-prefix \u5C5E\u6027stringvan-icon
transition\u52A8\u753B\u7C7B\u540D\uFF0C\u7B49\u4EF7\u4E8E transition \u7684 name \u5C5E\u6027string-
transition-appear\u662F\u5426\u5728\u521D\u59CB\u6E32\u67D3\u65F6\u542F\u7528\u8FC7\u6E21\u52A8\u753Bbooleanfalse
teleport\u6307\u5B9A\u6302\u8F7D\u7684\u8282\u70B9\uFF0C\u7B49\u540C\u4E8E Teleport \u7EC4\u4EF6\u7684 to \u5C5E\u6027string | Element-
safe-area-inset-top\u662F\u5426\u5F00\u542F\u9876\u90E8\u5B89\u5168\u533A\u9002\u914Dbooleanfalse
safe-area-inset-bottom\u662F\u5426\u5F00\u542F\u5E95\u90E8\u5B89\u5168\u533A\u9002\u914Dbooleanfalse
\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\n\n\n\n\n
\u4E8B\u4EF6\u540D\u8BF4\u660E\u56DE\u8C03\u53C2\u6570
click\u70B9\u51FB\u5F39\u51FA\u5C42\u65F6\u89E6\u53D1event: MouseEvent
click-overlay\u70B9\u51FB\u906E\u7F69\u5C42\u65F6\u89E6\u53D1event: MouseEvent
click-close-icon\u70B9\u51FB\u5173\u95ED\u56FE\u6807\u65F6\u89E6\u53D1event: MouseEvent
open\u6253\u5F00\u5F39\u51FA\u5C42\u65F6\u7ACB\u5373\u89E6\u53D1-
close\u5173\u95ED\u5F39\u51FA\u5C42\u65F6\u7ACB\u5373\u89E6\u53D1-
opened\u6253\u5F00\u5F39\u51FA\u5C42\u4E14\u52A8\u753B\u7ED3\u675F\u540E\u89E6\u53D1-
closed\u5173\u95ED\u5F39\u51FA\u5C42\u4E14\u52A8\u753B\u7ED3\u675F\u540E\u89E6\u53D1-
\n

Slots

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u540D\u79F0\u8BF4\u660E
default\u5F39\u7A97\u5185\u5BB9
overlay-content\u906E\u7F69\u5C42\u7684\u5185\u5BB9
\n

\u7C7B\u578B\u5B9A\u4E49

\n

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

\n
import type {\n  PopupProps,\n  PopupPosition,\n  PopupInstance,\n  PopupCloseIconPosition,\n} 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
\u540D\u79F0\u9ED8\u8BA4\u503C\u63CF\u8FF0
--van-popup-backgroundvar(--van-background-2)-
--van-popup-transitiontransform var(--van-duration-base)-
--van-popup-round-radius16px-
--van-popup-close-icon-size22px-
--van-popup-close-icon-colorvar(--van-gray-5)-
--van-popup-close-icon-margin16px-
--van-popup-close-icon-z-index1-
\n
'},null,8,l))}}}]);