mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
2 lines
14 KiB
JavaScript
2 lines
14 KiB
JavaScript
/*! For license information please see 692.8ac53ad0.js.LICENSE.txt */
|
|
(self.webpackChunk=self.webpackChunk||[]).push([["692"],{31722: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:'<h1>Space</h1>\n<div class="van-doc-card"><h3 id="intro" tabindex="-1">Intro</h3>\n<p>Set the spacing between elements.</p>\n</div><div class="van-doc-card"><h3 id="install" tabindex="-1">Install</h3>\n<p>Register component globally via <code>app.use</code>, refer to <a href="#/en-US/advanced-usage#zu-jian-zhu-ce" target="_blank">Component Registration</a> for more registration ways.</p>\n<pre><code class="language-js"><span class="hljs-keyword">import</span> { createApp } <span class="hljs-keyword">from</span> <span class="hljs-string">'vue'</span>;\n<span class="hljs-keyword">import</span> { <span class="hljs-title class_">Space</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'vant'</span>;\n\n<span class="hljs-keyword">const</span> app = <span class="hljs-title function_">createApp</span>();\napp.<span class="hljs-title function_">use</span>(<span class="hljs-title class_">Space</span>);\n</code></pre>\n</div><h2 id="usage" tabindex="-1">Usage</h2>\n<div class="van-doc-card"><h3 id="basic-usage" tabindex="-1">Basic Usage</h3>\n<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-space</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n<span class="hljs-tag"></<span class="hljs-name">van-space</span>></span>\n</code></pre>\n</div><div class="van-doc-card"><h3 id="vertical" tabindex="-1">Vertical</h3>\n<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-space</span> <span class="hljs-attr">direction</span>=<span class="hljs-string">"vertical"</span> <span class="hljs-attr">fill</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span> <span class="hljs-attr">block</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span> <span class="hljs-attr">block</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span> <span class="hljs-attr">block</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n<span class="hljs-tag"></<span class="hljs-name">van-space</span>></span>\n</code></pre>\n</div><div class="van-doc-card"><h3 id="custom-size" tabindex="-1">Custom Size</h3>\n<pre><code class="language-html"><span class="hljs-comment"><!-- 20px --></span>\n<span class="hljs-tag"><<span class="hljs-name">van-space</span> <span class="hljs-attr">:size</span>=<span class="hljs-string">"20"</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n<span class="hljs-tag"></<span class="hljs-name">van-space</span>></span>\n\n<span class="hljs-comment"><!-- 2rem --></span>\n<span class="hljs-tag"><<span class="hljs-name">van-space</span> <span class="hljs-attr">size</span>=<span class="hljs-string">"2rem"</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n<span class="hljs-tag"></<span class="hljs-name">van-space</span>></span>\n</code></pre>\n</div><div class="van-doc-card"><h3 id="alignment" tabindex="-1">Alignment</h3>\n<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-radio-group</span>\n <span class="hljs-attr">v-model</span>=<span class="hljs-string">"align"</span>\n <span class="hljs-attr">direction</span>=<span class="hljs-string">"horizontal"</span>\n <span class="hljs-attr">style</span>=<span class="hljs-string">"margin-bottom: 16px"</span>\n></span>\n <span class="hljs-tag"><<span class="hljs-name">van-radio</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"start"</span>></span>start<span class="hljs-tag"></<span class="hljs-name">van-radio</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-radio</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"center"</span>></span>center<span class="hljs-tag"></<span class="hljs-name">van-radio</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-radio</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"end"</span>></span>end<span class="hljs-tag"></<span class="hljs-name">van-radio</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-radio</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"baseline"</span>></span>baseline<span class="hljs-tag"></<span class="hljs-name">van-radio</span>></span>\n<span class="hljs-tag"></<span class="hljs-name">van-radio-group</span>></span>\n\n<span class="hljs-tag"><<span class="hljs-name">van-space</span> <span class="hljs-attr">:align</span>=<span class="hljs-string">"align"</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"padding: 16px; background: #f3f2f5"</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span>></span>{{ align }}<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"padding: 40px 20px; background: #fff"</span>></span>Block<span class="hljs-tag"></<span class="hljs-name">div</span>></span>\n<span class="hljs-tag"></<span class="hljs-name">van-space</span>></span>\n</code></pre>\n<pre><code class="language-js"><span class="hljs-keyword">import</span> { ref } <span class="hljs-keyword">from</span> <span class="hljs-string">'vue'</span>;\n\n<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> {\n <span class="hljs-title function_">setup</span>(<span class="hljs-params"></span>) {\n <span class="hljs-keyword">const</span> align = <span class="hljs-title function_">ref</span>(<span class="hljs-string">'center'</span>);\n <span class="hljs-keyword">return</span> { align };\n },\n};\n</code></pre>\n</div><div class="van-doc-card"><h3 id="auto-wrap" tabindex="-1">Auto Wrap</h3>\n<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-space</span> <span class="hljs-attr">wrap</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span> <span class="hljs-attr">block</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span> <span class="hljs-attr">block</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span> <span class="hljs-attr">block</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span> <span class="hljs-attr">block</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span> <span class="hljs-attr">block</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span> <span class="hljs-attr">block</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span> <span class="hljs-attr">block</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"primary"</span> <span class="hljs-attr">block</span>></span>Button<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>\n<span class="hljs-tag"></<span class="hljs-name">van-space</span>></span>\n</code></pre>\n</div><h2 id="api" tabindex="-1">API</h2>\n<div class="van-doc-card"><h3 id="props" tabindex="-1">Props</h3>\n<table>\n<thead>\n<tr>\n<th>Attribute</th>\n<th>Description</th>\n<th>Type</th>\n<th>Default</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>direction</td>\n<td>Spacing direction</td>\n<td><em>vertical | horizontal</em></td>\n<td><code>horizontal</code></td>\n</tr>\n<tr>\n<td>size</td>\n<td>Spacing size, such as <code>20px</code> <code>2em</code>. The default unit is px, supports using array to set horizontal and vertical spacing</td>\n<td><em>number | string | number[] | string[]</em></td>\n<td><code>8px</code></td>\n</tr>\n<tr>\n<td>align</td>\n<td>Spacing alignment</td>\n<td><em>start | end | center | baseline</em></td>\n<td>-</td>\n</tr>\n<tr>\n<td>wrap</td>\n<td>Whether to wrap automatically, only for horizontal alignment</td>\n<td><em>boolean</em></td>\n<td><code>false</code></td>\n</tr>\n<tr>\n<td>fill</td>\n<td>Whether to render Space as a block element and fill the parent element</td>\n<td><em>boolean</em></td>\n<td><code>false</code></td>\n</tr>\n</tbody>\n</table>\n</div><div class="van-doc-card"><h3 id="slots" tabindex="-1">Slots</h3>\n<table>\n<thead>\n<tr>\n<th>Name</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>default</td>\n<td>Default slot</td>\n</tr>\n</tbody>\n</table>\n</div><div class="van-doc-card"><h3 id="types" tabindex="-1">Types</h3>\n<p>The component exports the following type definitions:</p>\n<pre><code class="language-ts"><span class="hljs-keyword">import</span> <span class="hljs-keyword">type</span> { <span class="hljs-title class_">SpaceProps</span>, <span class="hljs-title class_">SpaceSize</span>, <span class="hljs-title class_">SpaceAlign</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'vant'</span>;\n</code></pre>\n</div>'},null,8,l))}}}]); |