mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
/*! For license information please see 8284.1f12d2c6.js.LICENSE.txt */
|
|
(self.webpackChunk=self.webpackChunk||[]).push([["8284"],{89306: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 \u95F4\u8DDD</h1>\n<div class="van-doc-card"><h3 id="jie-shao" tabindex="-1">\u4ECB\u7ECD</h3>\n<p>\u8BBE\u7F6E\u5143\u7D20\u4E4B\u95F4\u7684\u95F4\u8DDD\u3002</p>\n</div><div class="van-doc-card"><h3 id="yin-ru" tabindex="-1">\u5F15\u5165</h3>\n<p>\u901A\u8FC7\u4EE5\u4E0B\u65B9\u5F0F\u6765\u5168\u5C40\u6CE8\u518C\u7EC4\u4EF6\uFF0C\u66F4\u591A\u6CE8\u518C\u65B9\u5F0F\u8BF7\u53C2\u8003<a href="#/zh-CN/advanced-usage#zu-jian-zhu-ce" target="_blank">\u7EC4\u4EF6\u6CE8\u518C</a>\u3002</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="dai-ma-yan-shi" tabindex="-1">\u4EE3\u7801\u6F14\u793A</h2>\n<div class="van-doc-card"><h3 id="ji-chu-yong-fa" tabindex="-1">\u57FA\u7840\u7528\u6CD5</h3>\n<p>Space \u7EC4\u4EF6\u4F1A\u5728\u5404\u4E2A\u5B50\u7EC4\u4EF6\u4E4B\u95F4\u8BBE\u7F6E\u4E00\u5B9A\u7684\u95F4\u8DDD\uFF0C\u9ED8\u8BA4\u95F4\u8DDD\u4E3A <code>8px</code>\u3002</p>\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>\u6309\u94AE<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>\u6309\u94AE<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>\u6309\u94AE<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>\u6309\u94AE<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="chui-zhi-pai-lie" tabindex="-1">\u5782\u76F4\u6392\u5217</h3>\n<p>\u5C06 <code>direction</code> \u5C5E\u6027\u8BBE\u7F6E\u4E3A <code>vertical</code>\uFF0C\u53EF\u4EE5\u8BBE\u7F6E\u5782\u76F4\u65B9\u5411\u6392\u5217\u7684\u95F4\u8DDD\u3002</p>\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>\u6309\u94AE<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>\u6309\u94AE<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>\u6309\u94AE<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="zi-ding-yi-jian-ju" tabindex="-1">\u81EA\u5B9A\u4E49\u95F4\u8DDD</h3>\n<p>\u901A\u8FC7\u8C03\u6574 <code>size</code> \u7684\u503C\u6765\u63A7\u5236\u95F4\u8DDD\u7684\u5927\u5C0F\u3002\u4F20\u5165 <code>number</code> \u7C7B\u578B\u65F6\uFF0C\u4F1A\u9ED8\u8BA4\u4F7F\u7528 <code>px</code> \u5355\u4F4D\uFF1B\u4E5F\u53EF\u4EE5\u4F20\u5165 <code>string</code> \u7C7B\u578B\uFF0C\u6BD4\u5982 <code>2rem</code> \u6216 <code>5vw</code> \u7B49\u5E26\u6709\u5355\u4F4D\u7684\u503C\u3002</p>\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>\u6309\u94AE<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>\u6309\u94AE<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>\u6309\u94AE<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>\u6309\u94AE<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>\u6309\u94AE<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>\u6309\u94AE<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="dui-qi-fang-shi" tabindex="-1">\u5BF9\u9F50\u65B9\u5F0F</h3>\n<p>\u901A\u8FC7\u8C03\u6574 <code>align</code> \u7684\u503C\u6765\u8BBE\u7F6E\u5B50\u5143\u7D20\u7684\u5BF9\u9F50\u65B9\u5F0F, \u53EF\u9009\u503C\u4E3A <code>start</code>, <code>center</code> ,<code>end</code> ,<code>baseline</code>\uFF0C\u5728\u6C34\u5E73\u6A21\u5F0F\u4E0B\u7684\u9ED8\u8BA4\u503C\u4E3A <code>center</code>\u3002</p>\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="zi-dong-huan-xing" tabindex="-1">\u81EA\u52A8\u6362\u884C</h3>\n<p>\u5728\u6C34\u5E73\u6A21\u5F0F\u4E0B, \u901A\u8FC7 <code>wrap</code> \u5C5E\u6027\u6765\u63A7\u5236\u5B50\u5143\u7D20\u662F\u5426\u81EA\u52A8\u6362\u884C\u3002</p>\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>\u6309\u94AE<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>\u6309\u94AE<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>\u6309\u94AE<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>\u6309\u94AE<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>\u6309\u94AE<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>\u6309\u94AE<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>\u6309\u94AE<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>\u6309\u94AE<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>\u53C2\u6570</th>\n<th>\u8BF4\u660E</th>\n<th>\u7C7B\u578B</th>\n<th>\u9ED8\u8BA4\u503C</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>direction</td>\n<td>\u95F4\u8DDD\u65B9\u5411</td>\n<td><em>vertical | horizontal</em></td>\n<td><code>horizontal</code></td>\n</tr>\n<tr>\n<td>size</td>\n<td>\u95F4\u8DDD\u5927\u5C0F\uFF0C\u5982 <code>20px</code> <code>2em</code>\uFF0C\u9ED8\u8BA4\u5355\u4F4D\u4E3A <code>px</code>\uFF0C\u652F\u6301\u6570\u7EC4\u5F62\u5F0F\u6765\u5206\u522B\u8BBE\u7F6E\u6A2A\u5411\u548C\u7EB5\u5411\u95F4\u8DDD</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>\u8BBE\u7F6E\u5B50\u5143\u7D20\u7684\u5BF9\u9F50\u65B9\u5F0F</td>\n<td><em>start | end | center | baseline</em></td>\n<td>-</td>\n</tr>\n<tr>\n<td>wrap</td>\n<td>\u662F\u5426\u81EA\u52A8\u6362\u884C\uFF0C\u4EC5\u9002\u7528\u4E8E\u6C34\u5E73\u65B9\u5411\u6392\u5217</td>\n<td><em>boolean</em></td>\n<td><code>false</code></td>\n</tr>\n<tr>\n<td>fill</td>\n<td>\u662F\u5426\u8BA9 Space \u53D8\u4E3A\u4E00\u4E2A\u5757\u7EA7\u5143\u7D20\uFF0C\u586B\u5145\u6574\u4E2A\u7236\u5143\u7D20</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>\u540D\u79F0</th>\n<th>\u8BF4\u660E</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>default</td>\n<td>\u95F4\u8DDD\u7EC4\u4EF6\u5185\u5BB9</td>\n</tr>\n</tbody>\n</table>\n</div><div class="van-doc-card"><h3 id="lei-xing-ding-yi" tabindex="-1">\u7C7B\u578B\u5B9A\u4E49</h3>\n<p>\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A</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))}}}]); |