/*! For license information please see 2428.508082db.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["2428"],{92291: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:'
\u5E95\u90E8\u5BFC\u822A\u680F\uFF0C\u7528\u4E8E\u5728\u4E0D\u540C\u9875\u9762\u4E4B\u95F4\u8FDB\u884C\u5207\u6362\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 { Tabbar, TabbarItem } from 'vant';\n\nconst app = createApp();\napp.use(Tabbar);\napp.use(TabbarItem);\n
\nv-model
\u9ED8\u8BA4\u7ED1\u5B9A\u9009\u4E2D\u6807\u7B7E\u7684\u7D22\u5F15\u503C\uFF0C\u901A\u8FC7\u4FEE\u6539 v-model
\u5373\u53EF\u5207\u6362\u9009\u4E2D\u7684\u6807\u7B7E\u3002
<van-tabbar v-model="active">\n <van-tabbar-item icon="home-o">\u6807\u7B7E</van-tabbar-item>\n <van-tabbar-item icon="search">\u6807\u7B7E</van-tabbar-item>\n <van-tabbar-item icon="friends-o">\u6807\u7B7E</van-tabbar-item>\n <van-tabbar-item icon="setting-o">\u6807\u7B7E</van-tabbar-item>\n</van-tabbar>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const active = ref(0);\n return { active };\n },\n};\n
\n\u5728\u6807\u7B7E\u6307\u5B9A name
\u5C5E\u6027\u7684\u60C5\u51B5\u4E0B\uFF0Cv-model
\u7684\u503C\u4E3A\u5F53\u524D\u6807\u7B7E\u7684 name
\u3002
<van-tabbar v-model="active">\n <van-tabbar-item name="home" icon="home-o">\u6807\u7B7E</van-tabbar-item>\n <van-tabbar-item name="search" icon="search">\u6807\u7B7E</van-tabbar-item>\n <van-tabbar-item name="friends" icon="friends-o">\u6807\u7B7E</van-tabbar-item>\n <van-tabbar-item name="setting" icon="setting-o">\u6807\u7B7E</van-tabbar-item>\n</van-tabbar>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const active = ref('home');\n return { active };\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-tabbar v-model="active">\n <van-tabbar-item icon="home-o">\u6807\u7B7E</van-tabbar-item>\n <van-tabbar-item icon="search" dot>\u6807\u7B7E</van-tabbar-item>\n <van-tabbar-item icon="friends-o" badge="5">\u6807\u7B7E</van-tabbar-item>\n <van-tabbar-item icon="setting-o" badge="20">\u6807\u7B7E</van-tabbar-item>\n</van-tabbar>\n
\n\u901A\u8FC7 icon
\u63D2\u69FD\u81EA\u5B9A\u4E49\u56FE\u6807\uFF0C\u53EF\u4EE5\u901A\u8FC7 slot-scope
\u5224\u65AD\u6807\u7B7E\u662F\u5426\u9009\u4E2D\u3002
<van-tabbar v-model="active">\n <van-tabbar-item badge="3">\n <span>\u81EA\u5B9A\u4E49</span>\n <template #icon="props">\n <img :src="props.active ? icon.active : icon.inactive" />\n </template>\n </van-tabbar-item>\n <van-tabbar-item icon="search">\u6807\u7B7E</van-tabbar-item>\n <van-tabbar-item icon="setting-o">\u6807\u7B7E</van-tabbar-item>\n</van-tabbar>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const active = ref(0);\n const icon = {\n active: 'https://fastly.jsdelivr.net/npm/@vant/assets/user-active.png',\n inactive:\n 'https://fastly.jsdelivr.net/npm/@vant/assets/user-inactive.png',\n };\n return {\n icon,\n active,\n };\n },\n};\n
\n\u901A\u8FC7 active-color
\u5C5E\u6027\u8BBE\u7F6E\u9009\u4E2D\u6807\u7B7E\u7684\u989C\u8272\uFF0C\u901A\u8FC7 inactive-color
\u5C5E\u6027\u8BBE\u7F6E\u672A\u9009\u4E2D\u6807\u7B7E\u7684\u989C\u8272\u3002
<van-tabbar v-model="active" active-color="#ee0a24">\n <van-tabbar-item icon="home-o">\u6807\u7B7E</van-tabbar-item>\n <van-tabbar-item icon="search">\u6807\u7B7E</van-tabbar-item>\n <van-tabbar-item icon="friends-o">\u6807\u7B7E</van-tabbar-item>\n <van-tabbar-item icon="setting-o">\u6807\u7B7E</van-tabbar-item>\n</van-tabbar>\n
\n\u901A\u8FC7 change
\u4E8B\u4EF6\u6765\u76D1\u542C\u9009\u4E2D\u6807\u7B7E\u7684\u53D8\u5316\u3002
<van-tabbar v-model="active" @change="onChange">\n <van-tabbar-item icon="home-o">\u6807\u7B7E 1</van-tabbar-item>\n <van-tabbar-item icon="search">\u6807\u7B7E 2</van-tabbar-item>\n <van-tabbar-item icon="friends-o">\u6807\u7B7E 3</van-tabbar-item>\n <van-tabbar-item icon="setting-o">\u6807\u7B7E 4</van-tabbar-item>\n</van-tabbar>\n
\nimport { ref } from 'vue';\nimport { showToast } from 'vant';\n\nexport default {\n setup() {\n const active = ref(0);\n const onChange = (index) => showToast(`\u6807\u7B7E ${index}`);\n return {\n icon,\n onChange,\n };\n },\n};\n
\n\u6807\u7B7E\u680F\u652F\u6301\u8DEF\u7531\u6A21\u5F0F\uFF0C\u7528\u4E8E\u642D\u914D Vue Router \u4F7F\u7528\u3002\u8DEF\u7531\u6A21\u5F0F\u4E0B\u4F1A\u5339\u914D\u9875\u9762\u8DEF\u5F84\u548C\u6807\u7B7E\u7684 to
\u5C5E\u6027\uFF0C\u5E76\u81EA\u52A8\u9009\u4E2D\u5BF9\u5E94\u7684\u6807\u7B7E\u3002
<router-view />\n\n<van-tabbar route>\n <van-tabbar-item replace to="/home" icon="home-o">\u6807\u7B7E</van-tabbar-item>\n <van-tabbar-item replace to="/search" icon="search">\u6807\u7B7E</van-tabbar-item>\n</van-tabbar>\n
\n\u53C2\u6570 | \n\u8BF4\u660E | \n\u7C7B\u578B | \n\u9ED8\u8BA4\u503C | \n
---|---|---|---|
v-model | \n\u5F53\u524D\u9009\u4E2D\u6807\u7B7E\u7684\u540D\u79F0\u6216\u7D22\u5F15\u503C | \nnumber | string | \n0 | \n
fixed | \n\u662F\u5426\u56FA\u5B9A\u5728\u5E95\u90E8 | \nboolean | \ntrue | \n
border | \n\u662F\u5426\u663E\u793A\u5916\u8FB9\u6846 | \nboolean | \ntrue | \n
z-index | \n\u5143\u7D20 z-index | \nnumber | string | \n1 | \n
active-color | \n\u9009\u4E2D\u6807\u7B7E\u7684\u989C\u8272 | \nstring | \n#1989fa | \n
inactive-color | \n\u672A\u9009\u4E2D\u6807\u7B7E\u7684\u989C\u8272 | \nstring | \n#7d7e80 | \n
route | \n\u662F\u5426\u5F00\u542F\u8DEF\u7531\u6A21\u5F0F | \nboolean | \nfalse | \n
placeholder | \n\u56FA\u5B9A\u5728\u5E95\u90E8\u65F6\uFF0C\u662F\u5426\u5728\u6807\u7B7E\u4F4D\u7F6E\u751F\u6210\u4E00\u4E2A\u7B49\u9AD8\u7684\u5360\u4F4D\u5143\u7D20 | \nboolean | \nfalse | \n
safe-area-inset-bottom | \n\u662F\u5426\u5F00\u542F\u5E95\u90E8\u5B89\u5168\u533A\u9002\u914D\uFF0C\u8BBE\u7F6E fixed \u65F6\u9ED8\u8BA4\u5F00\u542F | \nboolean | \nfalse | \n
before-change | \n\u5207\u6362\u6807\u7B7E\u524D\u7684\u56DE\u8C03\u51FD\u6570\uFF0C\u8FD4\u56DE false \u53EF\u963B\u6B62\u5207\u6362\uFF0C\u652F\u6301\u8FD4\u56DE Promise | \n(name: number | string) => boolean | Promise<boolean> | \n- | \n
\u4E8B\u4EF6\u540D | \n\u8BF4\u660E | \n\u56DE\u8C03\u53C2\u6570 | \n
---|---|---|
change | \n\u5207\u6362\u6807\u7B7E\u65F6\u89E6\u53D1 | \nactive: number | string | \n
\u53C2\u6570 | \n\u8BF4\u660E | \n\u7C7B\u578B | \n\u9ED8\u8BA4\u503C | \n
---|---|---|---|
name | \n\u6807\u7B7E\u540D\u79F0\uFF0C\u4F5C\u4E3A\u5339\u914D\u7684\u6807\u8BC6\u7B26 | \nnumber | string | \n\u5F53\u524D\u6807\u7B7E\u7684\u7D22\u5F15\u503C | \n
icon | \n\u56FE\u6807\u540D\u79F0\u6216\u56FE\u7247\u94FE\u63A5\uFF0C\u7B49\u540C\u4E8E Icon \u7EC4\u4EF6\u7684 name \u5C5E\u6027 | \nstring | \n- | \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
dot | \n\u662F\u5426\u663E\u793A\u56FE\u6807\u53F3\u4E0A\u89D2\u5C0F\u7EA2\u70B9 | \nboolean | \nfalse | \n
badge | \n\u56FE\u6807\u53F3\u4E0A\u89D2\u5FBD\u6807\u7684\u5185\u5BB9 | \nnumber | string | \n- | \n
badge-props | \n\u81EA\u5B9A\u4E49\u5FBD\u6807\u7684\u5C5E\u6027\uFF0C\u4F20\u5165\u7684\u5BF9\u8C61\u4F1A\u88AB\u900F\u4F20\u7ED9 Badge \u7EC4\u4EF6\u7684 props | \nBadgeProps | \n- | \n
url | \n\u70B9\u51FB\u540E\u8DF3\u8F6C\u7684\u94FE\u63A5\u5730\u5740 | \nstring | \n- | \n
to | \n\u70B9\u51FB\u540E\u8DF3\u8F6C\u7684\u76EE\u6807\u8DEF\u7531\u5BF9\u8C61\uFF0C\u7B49\u540C\u4E8E Vue Router \u7684 to \u5C5E\u6027 | \nstring | object | \n- | \n
replace | \n\u662F\u5426\u5728\u8DF3\u8F6C\u65F6\u66FF\u6362\u5F53\u524D\u9875\u9762\u5386\u53F2 | \nboolean | \nfalse | \n
\u540D\u79F0 | \n\u8BF4\u660E | \n\u53C2\u6570 | \n
---|---|---|
icon | \n\u81EA\u5B9A\u4E49\u56FE\u6807 | \nactive: boolean | \n
\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A
\nimport type { TabbarProps, TabbarItemProps } 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-tabbar-height | \n50px | \n- | \n
--van-tabbar-z-index | \n1 | \n- | \n
--van-tabbar-background | \nvar(--van-background-2) | \n- | \n
--van-tabbar-item-font-size | \nvar(--van-font-size-sm) | \n- | \n
--van-tabbar-item-text-color | \nvar(--van-text-color) | \n- | \n
--van-tabbar-item-active-color | \nvar(--van-primary-color) | \n- | \n
--van-tabbar-item-active-background | \nvar(--van-background-2) | \n- | \n
--van-tabbar-item-line-height | \n1 | \n- | \n
--van-tabbar-item-icon-size | \n22px | \n- | \n
--van-tabbar-item-icon-margin-bottom | \nvar(--van-padding-base) | \n- | \n