/*! For license information please see 1771.f0e1a9d8.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["1771"],{66432: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:'
\u7528\u4E8E\u4ECE\u4E00\u7EC4\u76F8\u5173\u8054\u7684\u6570\u636E\u96C6\u5408\u4E2D\u8FDB\u884C\u9009\u62E9\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 { TreeSelect } from 'vant';\n\nconst app = createApp();\napp.use(TreeSelect);\n
\nitem
\u4E3A\u5206\u7C7B\u663E\u793A\u6240\u9700\u7684\u6570\u636E\uFF0C\u6570\u636E\u683C\u5F0F\u89C1\u4E0B\u65B9\u793A\u4F8B\u3002main-active-index
\u8868\u793A\u5DE6\u4FA7\u9AD8\u4EAE\u9009\u9879\u7684\u7D22\u5F15\uFF0Cactive-id
\u8868\u793A\u53F3\u4FA7\u9AD8\u4EAE\u9009\u9879\u7684 id\u3002
<van-tree-select\n v-model:active-id="activeId"\n v-model:main-active-index="activeIndex"\n :items="items"\n/>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const activeId = ref(1);\n const activeIndex = ref(0);\n const items = [\n {\n text: '\u6D59\u6C5F',\n children: [\n { text: '\u676D\u5DDE', id: 1 },\n { text: '\u6E29\u5DDE', id: 2 },\n { text: '\u5B81\u6CE2', id: 3, disabled: true },\n ],\n },\n {\n text: '\u6C5F\u82CF',\n children: [\n { text: '\u5357\u4EAC', id: 4 },\n { text: '\u65E0\u9521', id: 5 },\n { text: '\u5F90\u5DDE', id: 6 },\n ],\n },\n { text: '\u798F\u5EFA', disabled: true },\n ];\n\n return {\n items,\n activeId,\n activeIndex,\n };\n },\n};\n
\nactive-id
\u4E3A\u6570\u7EC4\u683C\u5F0F\u65F6\uFF0C\u53EF\u4EE5\u9009\u4E2D\u591A\u4E2A\u53F3\u4FA7\u9009\u9879\u3002
<van-tree-select\n v-model:active-id="activeIds"\n v-model:main-active-index="activeIndex"\n :items="items"\n/>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const activeIds = ref([1, 2]);\n const activeIndex = ref(0);\n const items = [\n {\n text: '\u6D59\u6C5F',\n children: [\n { text: '\u676D\u5DDE', id: 1 },\n { text: '\u6E29\u5DDE', id: 2 },\n { text: '\u5B81\u6CE2', id: 3, disabled: true },\n ],\n },\n {\n text: '\u6C5F\u82CF',\n children: [\n { text: '\u5357\u4EAC', id: 4 },\n { text: '\u65E0\u9521', id: 5 },\n { text: '\u5F90\u5DDE', id: 6 },\n ],\n },\n { text: '\u798F\u5EFA', disabled: true },\n ];\n\n return {\n items,\n activeIds,\n activeIndex,\n };\n },\n};\n
\n\u901A\u8FC7 content
\u63D2\u69FD\u53EF\u4EE5\u81EA\u5B9A\u4E49\u53F3\u4FA7\u533A\u57DF\u7684\u5185\u5BB9\u3002
<van-tree-select\n v-model:main-active-index="activeIndex"\n height="55vw"\n :items="items"\n>\n <template #content>\n <van-image\n v-if="activeIndex === 0"\n src="https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg"\n />\n <van-image\n v-if="activeIndex === 1"\n src="https://fastly.jsdelivr.net/npm/@vant/assets/apple-2.jpeg"\n />\n </template>\n</van-tree-select>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const activeIndex = ref(0);\n return {\n activeIndex,\n items: [{ text: '\u5206\u7EC4 1' }, { text: '\u5206\u7EC4 2' }],\n };\n },\n};\n
\n\u8BBE\u7F6E dot
\u5C5E\u6027\u540E\uFF0C\u4F1A\u5728\u56FE\u6807\u53F3\u4E0A\u89D2\u5C55\u793A\u4E00\u4E2A\u5C0F\u7EA2\u70B9\uFF1B\u8BBE\u7F6E badge
\u5C5E\u6027\u540E\uFF0C\u4F1A\u5728\u56FE\u6807\u53F3\u4E0A\u89D2\u5C55\u793A\u76F8\u5E94\u7684\u5FBD\u6807\u3002
<van-tree-select\n v-model:main-active-index="activeIndex"\n height="55vw"\n :items="items"\n/>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const activeIndex = ref(0);\n return {\n activeIndex,\n items: [\n {\n text: '\u6D59\u6C5F',\n children: [\n { text: '\u676D\u5DDE', id: 1 },\n { text: '\u6E29\u5DDE', id: 2 },\n { text: '\u5B81\u6CE2', id: 3, disabled: true },\n ],\n dot: true,\n },\n {\n text: '\u6C5F\u82CF',\n children: [\n { text: '\u5357\u4EAC', id: 4 },\n { text: '\u65E0\u9521', id: 5 },\n { text: '\u5F90\u5DDE', id: 6 },\n ],\n badge: 5,\n },\n ],\n };\n },\n};\n
\n\u53C2\u6570 | \n\u8BF4\u660E | \n\u7C7B\u578B | \n\u9ED8\u8BA4\u503C | \n
---|---|---|---|
v-model:main-active-index | \n\u5DE6\u4FA7\u9009\u4E2D\u9879\u7684\u7D22\u5F15 | \nnumber | string | \n0 | \n
v-model:active-id | \n\u53F3\u4FA7\u9009\u4E2D\u9879\u7684 id\uFF0C\u652F\u6301\u4F20\u5165\u6570\u7EC4 | \nnumber | string | (number | string)[] | \n0 | \n
items | \n\u5206\u7C7B\u663E\u793A\u6240\u9700\u7684\u6570\u636E | \nTreeSelectItem[] | \n[] | \n
height | \n\u9AD8\u5EA6\uFF0C\u9ED8\u8BA4\u5355\u4F4D\u4E3Apx | \nnumber | string | \n300 | \n
max | \n\u53F3\u4FA7\u9879\u6700\u5927\u9009\u4E2D\u4E2A\u6570 | \nnumber | string | \nInfinity | \n
selected-icon | \n\u81EA\u5B9A\u4E49\u53F3\u4FA7\u680F\u9009\u4E2D\u72B6\u6001\u7684\u56FE\u6807 | \nstring | \nsuccess | \n
\u4E8B\u4EF6\u540D | \n\u8BF4\u660E | \n\u56DE\u8C03\u53C2\u6570 | \n
---|---|---|
click-nav | \n\u70B9\u51FB\u5DE6\u4FA7\u5BFC\u822A\u65F6\u89E6\u53D1 | \nindex: number | \n
click-item | \n\u70B9\u51FB\u53F3\u4FA7\u9009\u62E9\u9879\u65F6\u89E6\u53D1 | \nitem: TreeSelectChild | \n
\u540D\u79F0 | \n\u8BF4\u660E | \n\u53C2\u6570 | \n
---|---|---|
nav-text v4.1.0 | \n\u81EA\u5B9A\u4E49\u5BFC\u822A\u540D\u79F0 | \nitem: TreeSelectChild | \n
content | \n\u81EA\u5B9A\u4E49\u53F3\u4FA7\u533A\u57DF\u5185\u5BB9 | \n- | \n
TreeSelectItem
\u6574\u4F53\u4E3A\u4E00\u4E2A\u6570\u7EC4\uFF0C\u6570\u7EC4\u5185\u5305\u542B\u4E00\u7CFB\u5217\u63CF\u8FF0\u5206\u7C7B\u7684\u5BF9\u8C61\uFF0C\u6BCF\u4E2A\u5206\u7C7B\u91CC\uFF0Ctext
\u8868\u793A\u5F53\u524D\u5206\u7C7B\u7684\u540D\u79F0\uFF0Cchildren
\u8868\u793A\u5206\u7C7B\u91CC\u7684\u53EF\u9009\u9879\u3002
[\n {\n // \u5BFC\u822A\u540D\u79F0\n text: '\u6240\u6709\u57CE\u5E02',\n // \u5BFC\u822A\u540D\u79F0\u53F3\u4E0A\u89D2\u5FBD\u6807\n badge: 3,\n // \u662F\u5426\u5728\u5BFC\u822A\u540D\u79F0\u53F3\u4E0A\u89D2\u663E\u793A\u5C0F\u7EA2\u70B9\n dot: true,\n // \u5BFC\u822A\u8282\u70B9\u989D\u5916\u7C7B\u540D\n className: 'my-class',\n // \u8BE5\u5BFC\u822A\u4E0B\u6240\u6709\u7684\u53EF\u9009\u9879\n children: [\n {\n // \u540D\u79F0\n text: '\u6E29\u5DDE',\n // id\uFF0C\u4F5C\u4E3A\u5339\u914D\u9009\u4E2D\u72B6\u6001\u7684\u6807\u8BC6\u7B26\n id: 1,\n // \u7981\u7528\u9009\u9879\n disabled: true,\n },\n {\n text: '\u676D\u5DDE',\n id: 2,\n },\n ],\n },\n];\n
\n\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A
\nimport type { TreeSelectItem, TreeSelectChild, TreeSelectProps } 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-tree-select-font-size | \nvar(--van-font-size-md) | \n- | \n
--van-tree-select-nav-background | \nvar(--van-background) | \n- | \n
--van-tree-select-content-background | \nvar(--van-background-2) | \n- | \n
--van-tree-select-nav-item-padding | \n14px var(--van-padding-sm) | \n- | \n
--van-tree-select-item-height | \n48px | \n- | \n
--van-tree-select-item-active-color | \nvar(--van-primary-color) | \n- | \n
--van-tree-select-item-disabled-color | \nvar(--van-gray-5) | \n- | \n
--van-tree-select-item-selected-size | \n16px | \n- | \n