/*! For license information please see 3460.1d6da2b5.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["3460"],{33031:function(s,a,n){"use strict";n.r(a);var t=n("80681");let l=["innerHTML"];a.default={setup:()=>({html:""}),render:()=>((0,t.wg)(),(0,t.iD)("div",{class:"van-doc-markdown-body",innerHTML:'
\u5C06\u4E00\u7EC4\u5185\u5BB9\u653E\u7F6E\u5728\u591A\u4E2A\u6298\u53E0\u9762\u677F\u4E2D\uFF0C\u70B9\u51FB\u9762\u677F\u7684\u6807\u9898\u53EF\u4EE5\u5C55\u5F00\u6216\u6536\u7F29\u5176\u5185\u5BB9\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 { Collapse, CollapseItem } from 'vant';\n\nconst app = createApp();\napp.use(Collapse);\napp.use(CollapseItem);\n
\n\u901A\u8FC7 v-model
\u63A7\u5236\u5C55\u5F00\u7684\u9762\u677F\u5217\u8868\uFF0CactiveNames
\u4E3A\u6570\u7EC4\u683C\u5F0F\u3002
<van-collapse v-model="activeNames">\n <van-collapse-item title="\u6807\u98981" name="1">\n \u4EE3\u7801\u662F\u5199\u51FA\u6765\u7ED9\u4EBA\u770B\u7684\uFF0C\u9644\u5E26\u80FD\u5728\u673A\u5668\u4E0A\u8FD0\u884C\u3002\n </van-collapse-item>\n <van-collapse-item title="\u6807\u98982" name="2">\n \u6280\u672F\u65E0\u975E\u5C31\u662F\u90A3\u4E9B\u5F00\u53D1\u5B83\u7684\u4EBA\u7684\u5171\u540C\u7075\u9B42\u3002\n </van-collapse-item>\n <van-collapse-item title="\u6807\u98983" name="3">\n \u5728\u4EE3\u7801\u9605\u8BFB\u8FC7\u7A0B\u4E2D\u4EBA\u4EEC\u8BF4\u810F\u8BDD\u7684\u9891\u7387\u662F\u8861\u91CF\u4EE3\u7801\u8D28\u91CF\u7684\u552F\u4E00\u6807\u51C6\u3002\n </van-collapse-item>\n</van-collapse>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const activeNames = ref(['1']);\n return { activeNames };\n },\n};\n
\n\u901A\u8FC7 accordion
\u53EF\u4EE5\u8BBE\u7F6E\u4E3A\u624B\u98CE\u7434\u6A21\u5F0F\uFF0C\u6700\u591A\u5C55\u5F00\u4E00\u4E2A\u9762\u677F\uFF0C\u6B64\u65F6 activeName
\u4E3A\u5B57\u7B26\u4E32\u683C\u5F0F\u3002
<van-collapse v-model="activeName" accordion>\n <van-collapse-item title="\u6807\u98981" name="1">\n \u4EE3\u7801\u662F\u5199\u51FA\u6765\u7ED9\u4EBA\u770B\u7684\uFF0C\u9644\u5E26\u80FD\u5728\u673A\u5668\u4E0A\u8FD0\u884C\u3002\n </van-collapse-item>\n <van-collapse-item title="\u6807\u98982" name="2">\n \u6280\u672F\u65E0\u975E\u5C31\u662F\u90A3\u4E9B\u5F00\u53D1\u5B83\u7684\u4EBA\u7684\u5171\u540C\u7075\u9B42\u3002\n </van-collapse-item>\n <van-collapse-item title="\u6807\u98983" name="3">\n \u5728\u4EE3\u7801\u9605\u8BFB\u8FC7\u7A0B\u4E2D\u4EBA\u4EEC\u8BF4\u810F\u8BDD\u7684\u9891\u7387\u662F\u8861\u91CF\u4EE3\u7801\u8D28\u91CF\u7684\u552F\u4E00\u6807\u51C6\u3002\n </van-collapse-item>\n</van-collapse>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const activeName = ref('1');\n return { activeName };\n },\n};\n
\n\u901A\u8FC7 disabled
\u5C5E\u6027\u6765\u7981\u7528\u5355\u4E2A\u9762\u677F\u3002
<van-collapse v-model="activeNames">\n <van-collapse-item title="\u6807\u98981" name="1">\n \u4EE3\u7801\u662F\u5199\u51FA\u6765\u7ED9\u4EBA\u770B\u7684\uFF0C\u9644\u5E26\u80FD\u5728\u673A\u5668\u4E0A\u8FD0\u884C\u3002\n </van-collapse-item>\n <van-collapse-item title="\u6807\u98982" name="2" disabled>\n \u6280\u672F\u65E0\u975E\u5C31\u662F\u90A3\u4E9B\u5F00\u53D1\u5B83\u7684\u4EBA\u7684\u5171\u540C\u7075\u9B42\u3002\n </van-collapse-item>\n <van-collapse-item title="\u6807\u98983" name="3" disabled>\n \u5728\u4EE3\u7801\u9605\u8BFB\u8FC7\u7A0B\u4E2D\u4EBA\u4EEC\u8BF4\u810F\u8BDD\u7684\u9891\u7387\u662F\u8861\u91CF\u4EE3\u7801\u8D28\u91CF\u7684\u552F\u4E00\u6807\u51C6\u3002\n </van-collapse-item>\n</van-collapse>\n
\n\u901A\u8FC7 title
\u63D2\u69FD\u53EF\u4EE5\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u7684\u5185\u5BB9\u3002
<van-collapse v-model="activeNames">\n <van-collapse-item name="1">\n <template #title>\n <div>\u6807\u98981 <van-icon name="question-o" /></div>\n </template>\n \u4EE3\u7801\u662F\u5199\u51FA\u6765\u7ED9\u4EBA\u770B\u7684\uFF0C\u9644\u5E26\u80FD\u5728\u673A\u5668\u4E0A\u8FD0\u884C\u3002\n </van-collapse-item>\n <van-collapse-item title="\u6807\u98982" name="2" icon="shop-o">\n \u6280\u672F\u65E0\u975E\u5C31\u662F\u90A3\u4E9B\u5F00\u53D1\u5B83\u7684\u4EBA\u7684\u5171\u540C\u7075\u9B42\u3002\n </van-collapse-item>\n</van-collapse>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const activeNames = ref(['1']);\n return { activeNames };\n },\n};\n
\n\u901A\u8FC7 Collapse
\u5B9E\u4F8B\u4E0A\u7684 toggleAll
\u65B9\u6CD5\u53EF\u4EE5\u5B9E\u73B0\u5168\u90E8\u5C55\u5F00\u4E0E\u5168\u90E8\u5207\u6362\u3002
<van-collapse v-model="activeNames" ref="collapse">\n <van-collapse-item title="\u6807\u98981" name="1">\n \u4EE3\u7801\u662F\u5199\u51FA\u6765\u7ED9\u4EBA\u770B\u7684\uFF0C\u9644\u5E26\u80FD\u5728\u673A\u5668\u4E0A\u8FD0\u884C\u3002\n </van-collapse-item>\n <van-collapse-item title="\u6807\u98982" name="2">\n \u6280\u672F\u65E0\u975E\u5C31\u662F\u90A3\u4E9B\u5F00\u53D1\u5B83\u7684\u4EBA\u7684\u5171\u540C\u7075\u9B42\u3002\n </van-collapse-item>\n <van-collapse-item title="\u6807\u98983" name="3">\n \u5728\u4EE3\u7801\u9605\u8BFB\u8FC7\u7A0B\u4E2D\u4EBA\u4EEC\u8BF4\u810F\u8BDD\u7684\u9891\u7387\u662F\u8861\u91CF\u4EE3\u7801\u8D28\u91CF\u7684\u552F\u4E00\u6807\u51C6\u3002\n </van-collapse-item>\n</van-collapse>\n\n<van-button type="primary" @click="openAll">\u5168\u90E8\u5C55\u5F00</van-button>\n<van-button type="primary" @click="toggleAll">\u5168\u90E8\u5207\u6362</van-button>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const activeNames = ref(['1']);\n const collapse = ref(null);\n\n const openAll = () => {\n collapse.value.toggleAll(true);\n }\n const toggleAll = () => {\n collapse.value.toggleAll();\n },\n\n return {\n activeNames,\n openAll,\n toggleAll,\n collapse,\n };\n },\n};\n
\n\n\nTips: \u624B\u98CE\u7434\u6A21\u5F0F\u4E0B\u65E0\u6CD5\u4F7F\u7528 toggleAll \u65B9\u6CD5\u3002
\n
\u53C2\u6570 | \n\u8BF4\u660E | \n\u7C7B\u578B | \n\u9ED8\u8BA4\u503C | \n
---|---|---|---|
v-model | \n\u5F53\u524D\u5C55\u5F00\u9762\u677F\u7684 name | \n\u624B\u98CE\u7434\u6A21\u5F0F\uFF1Anumber | string \u975E\u624B\u98CE\u7434\u6A21\u5F0F\uFF1A(number | string)[] | \n- | \n
accordion | \n\u662F\u5426\u5F00\u542F\u624B\u98CE\u7434\u6A21\u5F0F | \nboolean | \nfalse | \n
border | \n\u662F\u5426\u663E\u793A\u5916\u8FB9\u6846 | \nboolean | \ntrue | \n
\u4E8B\u4EF6\u540D | \n\u8BF4\u660E | \n\u56DE\u8C03\u53C2\u6570 | \n
---|---|---|
change | \n\u5207\u6362\u9762\u677F\u65F6\u89E6\u53D1 | \nactiveNames: \u7C7B\u578B\u4E0E v-model \u7ED1\u5B9A\u7684\u503C\u4E00\u81F4 | \n
\u53C2\u6570 | \n\u8BF4\u660E | \n\u7C7B\u578B | \n\u9ED8\u8BA4\u503C | \n
---|---|---|---|
name | \n\u552F\u4E00\u6807\u8BC6\u7B26\uFF0C\u9ED8\u8BA4\u4E3A\u7D22\u5F15\u503C | \nnumber | string | \nindex | \n
icon | \n\u6807\u9898\u680F\u5DE6\u4FA7\u56FE\u6807\u540D\u79F0\u6216\u56FE\u7247\u94FE\u63A5\uFF0C\u7B49\u540C\u4E8E Icon \u7EC4\u4EF6\u7684 name \u5C5E\u6027 | \nstring | \n- | \n
size | \n\u6807\u9898\u680F\u5927\u5C0F\uFF0C\u53EF\u9009\u503C\u4E3A large | \nstring | \n- | \n
title | \n\u6807\u9898\u680F\u5DE6\u4FA7\u5185\u5BB9 | \nnumber | string | \n- | \n
value | \n\u6807\u9898\u680F\u53F3\u4FA7\u5185\u5BB9 | \nnumber | string | \n- | \n
label | \n\u6807\u9898\u680F\u63CF\u8FF0\u4FE1\u606F | \nnumber | string | \n- | \n
border | \n\u662F\u5426\u663E\u793A\u5185\u8FB9\u6846 | \nboolean | \ntrue | \n
is-link | \n\u662F\u5426\u5C55\u793A\u6807\u9898\u680F\u53F3\u4FA7\u7BAD\u5934\u5E76\u5F00\u542F\u70B9\u51FB\u53CD\u9988 | \nboolean | \ntrue | \n
disabled | \n\u662F\u5426\u7981\u7528\u9762\u677F | \nboolean | \nfalse | \n
readonly | \n\u662F\u5426\u4E3A\u53EA\u8BFB\u72B6\u6001\uFF0C\u53EA\u8BFB\u72B6\u6001\u4E0B\u65E0\u6CD5\u64CD\u4F5C\u9762\u677F | \nboolean | \nfalse | \n
lazy-render | \n\u662F\u5426\u5728\u9996\u6B21\u5C55\u5F00\u65F6\u624D\u6E32\u67D3\u9762\u677F\u5185\u5BB9 | \nboolean | \ntrue | \n
title-class | \n\u5DE6\u4FA7\u6807\u9898\u989D\u5916\u7C7B\u540D | \nstring | \n- | \n
value-class | \n\u53F3\u4FA7\u5185\u5BB9\u989D\u5916\u7C7B\u540D | \nstring | \n- | \n
label-class | \n\u63CF\u8FF0\u4FE1\u606F\u989D\u5916\u7C7B\u540D | \nstring | \n- | \n
\u901A\u8FC7 ref \u53EF\u4EE5\u83B7\u53D6\u5230 CollapseItem \u5B9E\u4F8B\u5E76\u8C03\u7528\u5B9E\u4F8B\u65B9\u6CD5\uFF0C\u8BE6\u89C1\u7EC4\u4EF6\u5B9E\u4F8B\u65B9\u6CD5\u3002
\n\u65B9\u6CD5\u540D | \n\u8BF4\u660E | \n\u53C2\u6570 | \n\u8FD4\u56DE\u503C | \n
---|---|---|---|
toggleAll | \n\u5207\u6362\u6240\u6709\u9762\u677F\u5C55\u5F00\u72B6\u6001\uFF0C\u4F20 true \u4E3A\u5168\u90E8\u5C55\u5F00\uFF0Cfalse \u4E3A\u5168\u90E8\u6536\u8D77\uFF0C\u4E0D\u4F20\u53C2\u4E3A\u5168\u90E8\u5207\u6362 | \noptions?: boolean | object | \n- | \n
import { ref } from 'vue';\nimport type { CollapseInstance } from 'vant';\n\nconst collapseRef = ref<CollapseInstance>();\n\n// \u5168\u90E8\u5207\u6362\ncollapseRef.value?.toggleAll();\n// \u5168\u90E8\u5C55\u5F00\ncollapseRef.value?.toggleAll(true);\n// \u5168\u90E8\u6536\u8D77\ncollapseRef.value?.toggleAll(false);\n\n// \u5168\u90E8\u5168\u90E8\u5207\u6362\uFF0C\u5E76\u8DF3\u8FC7\u7981\u7528\u7684\u590D\u9009\u6846\ncollapseRef.value?.toggleAll({\n skipDisabled: true,\n});\n// \u5168\u90E8\u9009\u4E2D\uFF0C\u5E76\u8DF3\u8FC7\u7981\u7528\u7684\u590D\u9009\u6846\ncollapseRef.value?.toggleAll({\n expanded: true,\n skipDisabled: true,\n});\n
\n\u901A\u8FC7 ref \u53EF\u4EE5\u83B7\u53D6\u5230 CollapseItem \u5B9E\u4F8B\u5E76\u8C03\u7528\u5B9E\u4F8B\u65B9\u6CD5\uFF0C\u8BE6\u89C1\u7EC4\u4EF6\u5B9E\u4F8B\u65B9\u6CD5\u3002
\n\u65B9\u6CD5\u540D | \n\u8BF4\u660E | \n\u53C2\u6570 | \n\u8FD4\u56DE\u503C | \n
---|---|---|---|
toggle | \n\u5207\u6362\u9762\u677F\u5C55\u5F00\u72B6\u6001\uFF0C\u4F20 true \u4E3A\u5C55\u5F00\uFF0Cfalse \u4E3A\u6536\u8D77\uFF0C\u4E0D\u4F20\u53C2\u4E3A\u5207\u6362 | \nexpand?: boolean | \n- | \n
\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A
\nimport type {\n CollapseProps,\n CollapseItemProps,\n CollapseItemInstance,\n CollapseToggleAllOptions,\n} from 'vant';\n
\nCollapseItemInstance
\u662F\u7EC4\u4EF6\u5B9E\u4F8B\u7684\u7C7B\u578B\uFF0C\u7528\u6CD5\u5982\u4E0B\uFF1A
import { ref } from 'vue';\nimport type { CollapseItemInstance } from 'vant';\n\nconst collapseItemRef = ref<CollapseItemInstance>();\n\ncollapseItemRef.value?.toggle();\n
\n\u540D\u79F0 | \n\u8BF4\u660E | \n
---|---|
default | \n\u9762\u677F\u5185\u5BB9 | \n
title | \n\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u5DE6\u4FA7\u5185\u5BB9 | \n
value | \n\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u53F3\u4FA7\u5185\u5BB9 | \n
label | \n\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u63CF\u8FF0\u4FE1\u606F | \n
icon | \n\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u5DE6\u4FA7\u56FE\u6807 | \n
right-icon | \n\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u53F3\u4FA7\u56FE\u6807 | \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-collapse-item-duration | \nvar(--van-duration-base) | \n- | \n
--van-collapse-item-content-padding | \nvar(--van-padding-sm) var(--van-padding-md) | \n- | \n
--van-collapse-item-content-font-size | \nvar(--van-font-size-md) | \n- | \n
--van-collapse-item-content-line-height | \n1.5 | \n- | \n
--van-collapse-item-content-text-color | \nvar(--van-text-color-2) | \n- | \n
--van-collapse-item-content-background | \nvar(--van-background-2) | \n- | \n
--van-collapse-item-title-disabled-color | \nvar(--van-text-color-3) | \n- | \n