/*! For license information please see 4663.3a97b1a3.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["4663"],{22088: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:'
\u5F39\u51FA\u5F0F\u7684\u6C14\u6CE1\u83DC\u5355\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 { Popover } from 'vant';\n\nconst app = createApp();\napp.use(Popover);\n
\n\u5F53 Popover \u5F39\u51FA\u65F6\uFF0C\u4F1A\u57FA\u4E8E reference
\u63D2\u69FD\u7684\u5185\u5BB9\u8FDB\u884C\u5B9A\u4F4D\u3002
<van-popover v-model:show="showPopover" :actions="actions" @select="onSelect">\n <template #reference>\n <van-button type="primary">\u6D45\u8272\u98CE\u683C</van-button>\n </template>\n</van-popover>\n
\nimport { ref } from 'vue';\nimport { showToast } from 'vant';\n\nexport default {\n setup() {\n const showPopover = ref(false);\n\n // \u901A\u8FC7 actions \u5C5E\u6027\u6765\u5B9A\u4E49\u83DC\u5355\u9009\u9879\n const actions = [\n { text: '\u9009\u9879\u4E00' },\n { text: '\u9009\u9879\u4E8C' },\n { text: '\u9009\u9879\u4E09' },\n ];\n const onSelect = (action) => showToast(action.text);\n\n return {\n actions,\n onSelect,\n showPopover,\n };\n },\n};\n
\nPopover \u652F\u6301\u6D45\u8272\u548C\u6DF1\u8272\u4E24\u79CD\u98CE\u683C\uFF0C\u9ED8\u8BA4\u4E3A\u6D45\u8272\u98CE\u683C\uFF0C\u5C06 theme
\u5C5E\u6027\u8BBE\u7F6E\u4E3A dark
\u53EF\u5207\u6362\u4E3A\u6DF1\u8272\u98CE\u683C\u3002
<van-popover v-model:show="showPopover" theme="dark" :actions="actions">\n <template #reference>\n <van-button type="primary">\u6DF1\u8272\u98CE\u683C</van-button>\n </template>\n</van-popover>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const showPopover = ref(false);\n const actions = [\n { text: '\u9009\u9879\u4E00' },\n { text: '\u9009\u9879\u4E8C' },\n { text: '\u9009\u9879\u4E09' },\n ];\n\n return {\n actions,\n showPopover,\n };\n },\n};\n
\n\u5C06 actions-direction
\u5C5E\u6027\u8BBE\u7F6E\u4E3A horizontal
\u540E\uFF0C\u83DC\u5355\u9009\u9879\u4F1A\u53D8\u6210\u6C34\u5E73\u6392\u5217\u3002
<van-popover\n v-model:show="showPopover"\n :actions="actions"\n actions-direction="horizontal"\n>\n <template #reference>\n <van-button type="primary">\u6C34\u5E73\u6392\u5217</van-button>\n </template>\n</van-popover>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const showPopover = ref(false);\n const actions = [\n { text: '\u9009\u9879\u4E00' },\n { text: '\u9009\u9879\u4E8C' },\n { text: '\u9009\u9879\u4E09' },\n ];\n\n return {\n actions,\n showPopover,\n };\n },\n};\n
\n\u901A\u8FC7 placement
\u5C5E\u6027\u6765\u63A7\u5236\u6C14\u6CE1\u7684\u5F39\u51FA\u4F4D\u7F6E\u3002
<van-popover placement="top" />\n
\nplacement
\u652F\u6301\u4EE5\u4E0B\u503C\uFF1A
top # \u9876\u90E8\u4E2D\u95F4\u4F4D\u7F6E\ntop-start # \u9876\u90E8\u5DE6\u4FA7\u4F4D\u7F6E\ntop-end # \u9876\u90E8\u53F3\u4FA7\u4F4D\u7F6E\nleft # \u5DE6\u4FA7\u4E2D\u95F4\u4F4D\u7F6E\nleft-start # \u5DE6\u4FA7\u4E0A\u65B9\u4F4D\u7F6E\nleft-end # \u5DE6\u4FA7\u4E0B\u65B9\u4F4D\u7F6E\nright # \u53F3\u4FA7\u4E2D\u95F4\u4F4D\u7F6E\nright-start # \u53F3\u4FA7\u4E0A\u65B9\u4F4D\u7F6E\nright-end # \u53F3\u4FA7\u4E0B\u65B9\u4F4D\u7F6E\nbottom # \u5E95\u90E8\u4E2D\u95F4\u4F4D\u7F6E\nbottom-start # \u5E95\u90E8\u5DE6\u4FA7\u4F4D\u7F6E\nbottom-end # \u5E95\u90E8\u53F3\u4FA7\u4F4D\u7F6E\n
\n\u5728 actions
\u6570\u7EC4\u4E2D\uFF0C\u53EF\u4EE5\u901A\u8FC7 icon
\u5B57\u6BB5\u6765\u5B9A\u4E49\u9009\u9879\u7684\u56FE\u6807\uFF0C\u652F\u6301\u4F20\u5165\u56FE\u6807\u540D\u79F0\u6216\u56FE\u7247\u94FE\u63A5\uFF0C\u7B49\u540C\u4E8E Icon \u7EC4\u4EF6\u7684 name \u5C5E\u6027\u3002
<van-popover v-model:show="showPopover" :actions="actions">\n <template #reference>\n <van-button type="primary">\u5C55\u793A\u56FE\u6807</van-button>\n </template>\n</van-popover>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const showPopover = ref(false);\n const actions = [\n { text: '\u9009\u9879\u4E00', icon: 'add-o' },\n { text: '\u9009\u9879\u4E8C', icon: 'music-o' },\n { text: '\u9009\u9879\u4E09', icon: 'more-o' },\n ];\n\n return {\n actions,\n showPopover,\n };\n },\n};\n
\n\u5728 actions
\u6570\u7EC4\u4E2D\uFF0C\u53EF\u4EE5\u901A\u8FC7 disabled
\u5B57\u6BB5\u6765\u7981\u7528\u67D0\u4E2A\u9009\u9879\u3002
<van-popover v-model:show="showPopover" :actions="actions">\n <template #reference>\n <van-button type="primary">\u7981\u7528\u9009\u9879</van-button>\n </template>\n</van-popover>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const showPopover = ref(false);\n const actions = [\n { text: '\u9009\u9879\u4E00', disabled: true },\n { text: '\u9009\u9879\u4E8C', disabled: true },\n { text: '\u9009\u9879\u4E09' },\n ];\n\n return {\n actions,\n showPopover,\n };\n },\n};\n
\n\u901A\u8FC7\u9ED8\u8BA4\u63D2\u69FD\uFF0C\u53EF\u4EE5\u5728 Popover \u5185\u90E8\u653E\u7F6E\u4EFB\u610F\u5185\u5BB9\u3002
\n<van-popover v-model:show="showPopover">\n <van-grid\n square\n clickable\n :border="false"\n column-num="3"\n style="width: 240px;"\n >\n <van-grid-item\n v-for="i in 6"\n :key="i"\n text="\u9009\u9879"\n icon="photo-o"\n @click="showPopover = false"\n />\n </van-grid>\n <template #reference>\n <van-button type="primary">\u81EA\u5B9A\u4E49\u5185\u5BB9</van-button>\n </template>\n</van-popover>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const showPopover = ref(false);\n return { showPopover };\n },\n};\n
\n\u4F60\u53EF\u4EE5\u628A Popover \u5F53\u505A\u53D7\u63A7\u7EC4\u4EF6\u6216\u975E\u53D7\u63A7\u7EC4\u4EF6\u4F7F\u7528\uFF1A
\nv-model:show
\u65F6\uFF0CPopover \u4E3A\u53D7\u63A7\u7EC4\u4EF6\uFF0C\u6B64\u65F6\u7EC4\u4EF6\u7684\u663E\u793A\u5B8C\u5168\u7531 v-model:show
\u7684\u503C\u51B3\u5B9A\u3002v-model:show
\u65F6\uFF0CPopover \u4E3A\u975E\u53D7\u63A7\u7EC4\u4EF6\uFF0C\u6B64\u65F6\u4F60\u53EF\u4EE5\u901A\u8FC7 show
\u5C5E\u6027\u4F20\u5165\u4E00\u4E2A\u9ED8\u8BA4\u503C\uFF0C\u7EC4\u4EF6\u503C\u7684\u663E\u793A\u7531\u7EC4\u4EF6\u81EA\u8EAB\u63A7\u5236\u3002<van-popover :actions="actions" position="top-start" @select="onSelect">\n <template #reference>\n <van-button type="primary">\u975E\u53D7\u63A7\u6A21\u5F0F</van-button>\n </template>\n</van-popover>\n
\nimport { ref } from 'vue';\nimport { showToast } from 'vant';\n\nexport default {\n setup() {\n const actions = [\n { text: '\u9009\u9879\u4E00' },\n { text: '\u9009\u9879\u4E8C' },\n { text: '\u9009\u9879\u4E09' },\n ];\n const onSelect = (action) => showToast(action.text);\n return {\n actions,\n onSelect,\n };\n },\n};\n
\n\u53C2\u6570 | \n\u8BF4\u660E | \n\u7C7B\u578B | \n\u9ED8\u8BA4\u503C | \n
---|---|---|---|
v-model:show | \n\u662F\u5426\u5C55\u793A\u6C14\u6CE1\u5F39\u51FA\u5C42 | \nboolean | \nfalse | \n
actions | \n\u9009\u9879\u5217\u8868 | \nPopoverAction[] | \n[] | \n
actions-direction v4.4.1 | \n\u9009\u9879\u5217\u8868\u7684\u6392\u5217\u65B9\u5411\uFF0C\u53EF\u9009\u503C\u4E3A horizontal | \nPopoverActionsDirection | \nvertical | \n
placement | \n\u5F39\u51FA\u4F4D\u7F6E | \nPopoverPlacement | \nbottom | \n
theme | \n\u4E3B\u9898\u98CE\u683C\uFF0C\u53EF\u9009\u503C\u4E3A dark | \nPopoverTheme | \nlight | \n
trigger | \n\u89E6\u53D1\u65B9\u5F0F\uFF0C\u53EF\u9009\u503C\u4E3A manual | \nPopoverTrigger | \nclick | \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
offset | \n\u51FA\u73B0\u4F4D\u7F6E\u7684\u504F\u79FB\u91CF | \n[number, number] | \n[0, 8] | \n
overlay | \n\u662F\u5426\u663E\u793A\u906E\u7F69\u5C42 | \nboolean | \nfalse | \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
show-arrow | \n\u662F\u5426\u5C55\u793A\u5C0F\u7BAD\u5934 | \nboolean | \ntrue | \n
close-on-click-action | \n\u662F\u5426\u5728\u70B9\u51FB\u9009\u9879\u540E\u5173\u95ED | \nboolean | \ntrue | \n
close-on-click-outside | \n\u662F\u5426\u5728\u70B9\u51FB\u5916\u90E8\u5143\u7D20\u540E\u5173\u95ED\u83DC\u5355 | \nboolean | \ntrue | \n
close-on-click-overlay | \n\u662F\u5426\u5728\u70B9\u51FB\u906E\u7F69\u5C42\u540E\u5173\u95ED\u83DC\u5355 | \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 | \nbody | \n
icon-prefix | \n\u56FE\u6807\u7C7B\u540D\u524D\u7F00\uFF0C\u7B49\u540C\u4E8E Icon \u7EC4\u4EF6\u7684 class-prefix \u5C5E\u6027 | \nstring | \nvan-icon | \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
---|---|---|
text | \n\u9009\u9879\u6587\u5B57 | \nstring | \n
icon | \n\u6587\u5B57\u5DE6\u4FA7\u7684\u56FE\u6807\uFF0C\u652F\u6301\u4F20\u5165\u56FE\u6807\u540D\u79F0\u6216\u56FE\u7247\u94FE\u63A5\uFF0C\u7B49\u540C\u4E8E Icon \u7EC4\u4EF6\u7684 name \u5C5E\u6027 | \nstring | \n
color | \n\u9009\u9879\u6587\u5B57\u989C\u8272 | \nstring | \n
disabled | \n\u662F\u5426\u4E3A\u7981\u7528\u72B6\u6001 | \nboolean | \n
className | \n\u4E3A\u5BF9\u5E94\u9009\u9879\u6DFB\u52A0\u989D\u5916\u7684\u7C7B\u540D | \nstring | Array | object | \n
\u4E8B\u4EF6\u540D | \n\u8BF4\u660E | \n\u56DE\u8C03\u53C2\u6570 | \n
---|---|---|
select | \n\u70B9\u51FB\u9009\u9879\u65F6\u89E6\u53D1 | \naction: PopoverAction, index: number | \n
open | \n\u6253\u5F00\u83DC\u5355\u65F6\u89E6\u53D1 | \n- | \n
close | \n\u5173\u95ED\u83DC\u5355\u65F6\u89E6\u53D1 | \n- | \n
opened | \n\u6253\u5F00\u83DC\u5355\u4E14\u52A8\u753B\u7ED3\u675F\u540E\u89E6\u53D1 | \n- | \n
closed | \n\u5173\u95ED\u83DC\u5355\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\u83DC\u5355\u5185\u5BB9 | \n- | \n
reference | \n\u89E6\u53D1 Popover \u663E\u793A\u7684\u5143\u7D20\u5185\u5BB9 | \n- | \n
action | \n\u81EA\u5B9A\u4E49\u9009\u9879\u5185\u5BB9 | \n{ action: PopoverAction, index: number } | \n
\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A
\nimport type {\n PopoverProps,\n PopoverTheme,\n PopoverAction,\n PopoverActionsDirection,\n PopoverTrigger,\n PopoverPlacement,\n} 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-popover-arrow-size | \n6px | \n- | \n
--van-popover-radius | \nvar(--van-radius-lg) | \n- | \n
--van-popover-action-width | \n128px | \n- | \n
--van-popover-action-height | \n44px | \n- | \n
--van-popover-action-font-size | \nvar(--van-font-size-md) | \n- | \n
--van-popover-action-line-height | \nvar(--van-line-height-md) | \n- | \n
--van-popover-action-icon-size | \n20px | \n- | \n
--van-popover-horizontal-action-height | \n34px | \n- | \n
--van-popover-horizontal-action-icon-size | \n16px | \n- | \n
--van-popover-light-text-color | \nvar(--van-text-color) | \n- | \n
--van-popover-light-background | \nvar(--van-background-2) | \n- | \n
--van-popover-light-action-disabled-text-color | \nvar(--van-text-color-3) | \n- | \n
--van-popover-dark-text-color | \nvar(--van-white) | \n- | \n
--van-popover-dark-background | \n#4a4a4a | \n- | \n
--van-popover-dark-action-disabled-text-color | \nvar(--van-text-color-2) | \n- | \n
\u8FD9\u79CD\u60C5\u51B5\u901A\u5E38\u662F\u7531\u4E8E\u9879\u76EE\u4E2D\u5F15\u5165\u4E86 fastclick
\u5E93\u5BFC\u81F4\u7684\u3002\u5EFA\u8BAE\u79FB\u9664 fastclick
\uFF0C\u6216\u8005\u914D\u7F6E fastclick
\u7684 ignore \u89C4\u5219\u3002