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

Grid \u5BAB\u683C

\n

\u4ECB\u7ECD

\n

\u5BAB\u683C\u53EF\u4EE5\u5728\u6C34\u5E73\u65B9\u5411\u4E0A\u628A\u9875\u9762\u5206\u9694\u6210\u7B49\u5BBD\u5EA6\u7684\u533A\u5757\uFF0C\u7528\u4E8E\u5C55\u793A\u5185\u5BB9\u6216\u8FDB\u884C\u9875\u9762\u5BFC\u822A\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 { Grid, GridItem } from 'vant';\n\nconst app = createApp();\napp.use(Grid);\napp.use(GridItem);\n
\n

\u4EE3\u7801\u6F14\u793A

\n

\u57FA\u7840\u7528\u6CD5

\n

\u901A\u8FC7 icon \u5C5E\u6027\u8BBE\u7F6E\u683C\u5B50\u5185\u7684\u56FE\u6807\uFF0Ctext \u5C5E\u6027\u8BBE\u7F6E\u6587\u5B57\u5185\u5BB9\u3002

\n
<van-grid>\n  <van-grid-item icon="photo-o" text="\u6587\u5B57" />\n  <van-grid-item icon="photo-o" text="\u6587\u5B57" />\n  <van-grid-item icon="photo-o" text="\u6587\u5B57" />\n  <van-grid-item icon="photo-o" text="\u6587\u5B57" />\n</van-grid>\n
\n

\u81EA\u5B9A\u4E49\u5217\u6570

\n

\u9ED8\u8BA4\u4E00\u884C\u5C55\u793A\u56DB\u4E2A\u683C\u5B50\uFF0C\u53EF\u4EE5\u901A\u8FC7 column-num \u81EA\u5B9A\u4E49\u5217\u6570\u3002

\n
<van-grid :column-num="3">\n  <van-grid-item v-for="value in 6" :key="value" icon="photo-o" text="\u6587\u5B57" />\n</van-grid>\n
\n

\u81EA\u5B9A\u4E49\u5185\u5BB9

\n

\u901A\u8FC7\u63D2\u69FD\u53EF\u4EE5\u81EA\u5B9A\u4E49\u683C\u5B50\u5C55\u793A\u7684\u5185\u5BB9\u3002

\n
<van-grid :border="false" :column-num="3">\n  <van-grid-item>\n    <van-image\n      src="https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg"\n    />\n  </van-grid-item>\n  <van-grid-item>\n    <van-image\n      src="https://fastly.jsdelivr.net/npm/@vant/assets/apple-2.jpeg"\n    />\n  </van-grid-item>\n  <van-grid-item>\n    <van-image\n      src="https://fastly.jsdelivr.net/npm/@vant/assets/apple-3.jpeg"\n    />\n  </van-grid-item>\n</van-grid>\n
\n

\u6B63\u65B9\u5F62\u683C\u5B50

\n

\u8BBE\u7F6E square \u5C5E\u6027\u540E\uFF0C\u683C\u5B50\u7684\u9AD8\u5EA6\u4F1A\u548C\u5BBD\u5EA6\u4FDD\u6301\u4E00\u81F4\u3002

\n
<van-grid square>\n  <van-grid-item v-for="value in 8" :key="value" icon="photo-o" text="\u6587\u5B57" />\n</van-grid>\n
\n

\u683C\u5B50\u95F4\u8DDD

\n

\u901A\u8FC7 gutter \u5C5E\u6027\u8BBE\u7F6E\u683C\u5B50\u4E4B\u95F4\u7684\u8DDD\u79BB\u3002

\n
<van-grid :gutter="10">\n  <van-grid-item v-for="value in 8" :key="value" icon="photo-o" text="\u6587\u5B57" />\n</van-grid>\n
\n

\u5185\u5BB9\u6A2A\u6392

\n

\u5C06 direction \u5C5E\u6027\u8BBE\u7F6E\u4E3A horizontal\uFF0C\u53EF\u4EE5\u8BA9\u5BAB\u683C\u7684\u5185\u5BB9\u5448\u6A2A\u5411\u6392\u5217\u3002

\n
<van-grid direction="horizontal" :column-num="3">\n  <van-grid-item icon="photo-o" text="\u6587\u5B57" />\n  <van-grid-item icon="photo-o" text="\u6587\u5B57" />\n  <van-grid-item icon="photo-o" text="\u6587\u5B57" />\n</van-grid>\n
\n

\u9875\u9762\u5BFC\u822A

\n

\u901A\u8FC7 to \u5C5E\u6027\u8BBE\u7F6E Vue Router \u8DF3\u8F6C\u94FE\u63A5\uFF0C\u901A\u8FC7 url \u5C5E\u6027\u8BBE\u7F6E URL \u8DF3\u8F6C\u94FE\u63A5\u3002

\n
<van-grid clickable :column-num="2">\n  <van-grid-item icon="home-o" text="\u8DEF\u7531\u8DF3\u8F6C" to="/" />\n  <van-grid-item icon="search" text="URL \u8DF3\u8F6C" url="https://github.com" />\n</van-grid>\n
\n

\u5FBD\u6807\u63D0\u793A

\n

\u8BBE\u7F6E dot \u5C5E\u6027\u540E\uFF0C\u4F1A\u5728\u56FE\u6807\u53F3\u4E0A\u89D2\u5C55\u793A\u4E00\u4E2A\u5C0F\u7EA2\u70B9\u3002\u8BBE\u7F6E badge \u5C5E\u6027\u540E\uFF0C\u4F1A\u5728\u56FE\u6807\u53F3\u4E0A\u89D2\u5C55\u793A\u76F8\u5E94\u7684\u5FBD\u6807\u3002

\n
<van-grid :column-num="2">\n  <van-grid-item icon="home-o" text="\u6587\u5B57" dot />\n  <van-grid-item icon="search" text="\u6587\u5B57" badge="99+" />\n</van-grid>\n
\n

API

\n

Grid 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
\u53C2\u6570\u8BF4\u660E\u7C7B\u578B\u9ED8\u8BA4\u503C
column-num\u5217\u6570number | string4
icon-size\u56FE\u6807\u5927\u5C0F\uFF0C\u9ED8\u8BA4\u5355\u4F4D\u4E3Apxnumber | string28px
gutter\u683C\u5B50\u4E4B\u95F4\u7684\u95F4\u8DDD\uFF0C\u9ED8\u8BA4\u5355\u4F4D\u4E3Apxnumber | string0
border\u662F\u5426\u663E\u793A\u8FB9\u6846booleantrue
center\u662F\u5426\u5C06\u683C\u5B50\u5185\u5BB9\u5C45\u4E2D\u663E\u793Abooleantrue
square\u662F\u5426\u5C06\u683C\u5B50\u56FA\u5B9A\u4E3A\u6B63\u65B9\u5F62booleanfalse
clickable\u662F\u5426\u5F00\u542F\u683C\u5B50\u70B9\u51FB\u53CD\u9988booleanfalse
direction\u683C\u5B50\u5185\u5BB9\u6392\u5217\u7684\u65B9\u5411\uFF0C\u53EF\u9009\u503C\u4E3A horizontalstringvertical
reverse\u662F\u5426\u8C03\u6362\u56FE\u6807\u548C\u6587\u672C\u7684\u4F4D\u7F6Ebooleanfalse
\n

GridItem 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
\u53C2\u6570\u8BF4\u660E\u7C7B\u578B\u9ED8\u8BA4\u503C
text\u6587\u5B57string-
icon\u56FE\u6807\u540D\u79F0\u6216\u56FE\u7247\u94FE\u63A5\uFF0C\u7B49\u540C\u4E8E Icon \u7EC4\u4EF6\u7684 name \u5C5E\u6027string-
icon-prefix\u56FE\u6807\u7C7B\u540D\u524D\u7F00\uFF0C\u7B49\u540C\u4E8E Icon \u7EC4\u4EF6\u7684 class-prefix \u5C5E\u6027stringvan-icon
icon-color\u56FE\u6807\u989C\u8272\uFF0C\u7B49\u540C\u4E8E Icon \u7EC4\u4EF6\u7684 color \u5C5E\u6027string-
dot\u662F\u5426\u663E\u793A\u56FE\u6807\u53F3\u4E0A\u89D2\u5C0F\u7EA2\u70B9booleanfalse
badge\u56FE\u6807\u53F3\u4E0A\u89D2\u5FBD\u6807\u7684\u5185\u5BB9number | string-
badge-props\u81EA\u5B9A\u4E49\u5FBD\u6807\u7684\u5C5E\u6027\uFF0C\u4F20\u5165\u7684\u5BF9\u8C61\u4F1A\u88AB\u900F\u4F20\u7ED9 Badge \u7EC4\u4EF6\u7684 propsBadgeProps-
url\u70B9\u51FB\u540E\u8DF3\u8F6C\u7684\u94FE\u63A5\u5730\u5740string-
to\u70B9\u51FB\u540E\u8DF3\u8F6C\u7684\u76EE\u6807\u8DEF\u7531\u5BF9\u8C61\uFF0C\u7B49\u540C\u4E8E Vue Router \u7684 to \u5C5E\u6027string | object-
replace\u662F\u5426\u5728\u8DF3\u8F6C\u65F6\u66FF\u6362\u5F53\u524D\u9875\u9762\u5386\u53F2booleanfalse
\n

GridItem Events

\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\u683C\u5B50\u65F6\u89E6\u53D1event: MouseEvent
\n

GridItem Slots

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u540D\u79F0\u8BF4\u660E
default\u81EA\u5B9A\u4E49\u5BAB\u683C\u7684\u6240\u6709\u5185\u5BB9
icon\u81EA\u5B9A\u4E49\u56FE\u6807
text\u81EA\u5B9A\u4E49\u6587\u5B57
\n

\u7C7B\u578B\u5B9A\u4E49

\n

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

\n
import type { GridProps, GridDirection, GridItemProps } 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
\u540D\u79F0\u9ED8\u8BA4\u503C\u63CF\u8FF0
--van-grid-item-content-paddingvar(--van-padding-md) var(--van-padding-xs)-
--van-grid-item-content-backgroundvar(--van-background-2)-
--van-grid-item-content-active-colorvar(--van-active-color)-
--van-grid-item-icon-size28px-
--van-grid-item-text-colorvar(--van-text-color)-
--van-grid-item-text-font-sizevar(--van-font-size-sm)-
\n
'},null,8,l))}}}]);