vant/v3/assets/README.05c61dd9.js
2024-04-20 08:49:23 +00:00

52 lines
12 KiB
JavaScript

import{o as a,a as n,y as t}from"./vue-libs.b44bc779.js";const l={class:"van-doc-markdown-body"},p=t(`<h1>Layout</h1><div class="van-doc-card"><h3 id="intro" tabindex="-1">Intro</h3><p>Quickly and easily create layouts with <code>van-row</code> and <code>van-col</code>.</p></div><div class="van-doc-card"><h3 id="install" tabindex="-1">Install</h3><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><pre><code class="language-js"><span class="hljs-keyword">import</span> { createApp } <span class="hljs-keyword">from</span> <span class="hljs-string">&#39;vue&#39;</span>;
<span class="hljs-keyword">import</span> { <span class="hljs-title class_">Col</span>, <span class="hljs-title class_">Row</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&#39;vant&#39;</span>;
<span class="hljs-keyword">const</span> app = <span class="hljs-title function_">createApp</span>();
app.<span class="hljs-title function_">use</span>(<span class="hljs-title class_">Col</span>);
app.<span class="hljs-title function_">use</span>(<span class="hljs-title class_">Row</span>);
</code></pre></div><h2 id="usage" tabindex="-1">Usage</h2><div class="van-doc-card"><h3 id="basic-usage" tabindex="-1">Basic Usage</h3><p>Layout are based on 24-column. The attribute <code>span</code> in <code>Col</code> means the number of column the grid spans. Of course, You can use <code>offset</code> attribute to set number of spacing on the left side of the grid.</p><pre><code class="language-html"><span class="hljs-tag">&lt;<span class="hljs-name">van-row</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;8&quot;</span>&gt;</span>span: 8<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;8&quot;</span>&gt;</span>span: 8<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;8&quot;</span>&gt;</span>span: 8<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">van-row</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-row</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;4&quot;</span>&gt;</span>span: 4<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;10&quot;</span> <span class="hljs-attr">offset</span>=<span class="hljs-string">&quot;4&quot;</span>&gt;</span>offset: 4, span: 10<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;6&quot;</span>&gt;</span>span: 6<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">van-row</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-row</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">offset</span>=<span class="hljs-string">&quot;12&quot;</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;12&quot;</span>&gt;</span>offset: 12, span: 12<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">van-row</span>&gt;</span>
</code></pre></div><div class="van-doc-card"><h3 id="column-spacing" tabindex="-1">Column Spacing</h3><p>Set grid spacing using <code>gutter</code> attribute. The default value is 0.</p><pre><code class="language-html"><span class="hljs-tag">&lt;<span class="hljs-name">van-row</span> <span class="hljs-attr">gutter</span>=<span class="hljs-string">&quot;20&quot;</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;8&quot;</span>&gt;</span>span: 8<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;8&quot;</span>&gt;</span>span: 8<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;8&quot;</span>&gt;</span>span: 8<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">van-row</span>&gt;</span>
</code></pre></div><div class="van-doc-card"><h3 id="justify-content" tabindex="-1">Justify Content</h3><pre><code class="language-html"><span class="hljs-tag">&lt;<span class="hljs-name">van-row</span> <span class="hljs-attr">justify</span>=<span class="hljs-string">&quot;center&quot;</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;6&quot;</span>&gt;</span>span: 6<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;6&quot;</span>&gt;</span>span: 6<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;6&quot;</span>&gt;</span>span: 6<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">van-row</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-row</span> <span class="hljs-attr">justify</span>=<span class="hljs-string">&quot;end&quot;</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;6&quot;</span>&gt;</span>span: 6<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;6&quot;</span>&gt;</span>span: 6<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;6&quot;</span>&gt;</span>span: 6<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">van-row</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-row</span> <span class="hljs-attr">justify</span>=<span class="hljs-string">&quot;space-between&quot;</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;6&quot;</span>&gt;</span>span: 6<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;6&quot;</span>&gt;</span>span: 6<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;6&quot;</span>&gt;</span>span: 6<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">van-row</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-row</span> <span class="hljs-attr">justify</span>=<span class="hljs-string">&quot;space-around&quot;</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;6&quot;</span>&gt;</span>span: 6<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;6&quot;</span>&gt;</span>span: 6<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-col</span> <span class="hljs-attr">span</span>=<span class="hljs-string">&quot;6&quot;</span>&gt;</span>span: 6<span class="hljs-tag">&lt;/<span class="hljs-name">van-col</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">van-row</span>&gt;</span>
</code></pre></div><h2 id="api" tabindex="-1">API</h2><div class="van-doc-card"><h3 id="row-props" tabindex="-1">Row Props</h3><table><thead><tr><th>Attribute</th><th>Description</th><th>Type</th><th>Default</th></tr></thead><tbody><tr><td>gutter</td><td>Grid spacing\uFF08px\uFF09</td><td><em>number | string</em></td><td>-</td></tr><tr><td>tag</td><td>Custom element tag</td><td><em>string</em></td><td><code>div</code></td></tr><tr><td>justify</td><td>Flex main axis, can be set to end/center/space-around/space-between</td><td><em>string</em></td><td><code>start</code></td></tr><tr><td>align</td><td>Flex cross axis, be set to center/bottom</td><td><em>string</em></td><td><code>top</code></td></tr><tr><td>wrap <code>v3.0.11</code></td><td>Whether to wrap</td><td><em>boolean</em></td><td><code>true</code></td></tr></tbody></table></div><div class="van-doc-card"><h3 id="col-props" tabindex="-1">Col Props</h3><table><thead><tr><th>Attribute</th><th>Description</th><th>Type</th><th>Default</th></tr></thead><tbody><tr><td>span</td><td>number of column the grid spans</td><td><em>number | string</em></td><td>-</td></tr><tr><td>offset</td><td>number of spacing on the left side of the grid</td><td><em>number | string</em></td><td>-</td></tr><tr><td>tag</td><td>Custom element tag</td><td><em>string</em></td><td><code>div</code></td></tr></tbody></table></div><div class="van-doc-card"><h3 id="row-events" tabindex="-1">Row Events</h3><table><thead><tr><th>Event</th><th>Description</th><th>Arguments</th></tr></thead><tbody><tr><td>click</td><td>Emitted when the row is clicked</td><td><em>event: MouseEvent</em></td></tr></tbody></table></div><div class="van-doc-card"><h3 id="col-events" tabindex="-1">Col Events</h3><table><thead><tr><th>Event</th><th>Description</th><th>Arguments</th></tr></thead><tbody><tr><td>click</td><td>Emitted when the col is clicked</td><td><em>event: MouseEvent</em></td></tr></tbody></table></div><div class="van-doc-card"><h3 id="types" tabindex="-1">Types</h3><p>The component exports the following type definitions:</p><pre><code class="language-ts"><span class="hljs-keyword">import</span> <span class="hljs-keyword">type</span> { <span class="hljs-title class_">ColProps</span>, <span class="hljs-title class_">RowProps</span>, <span class="hljs-title class_">RowAlign</span>, <span class="hljs-title class_">RowJustify</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&#39;vant&#39;</span>;
</code></pre></div>`,13),c=[p],j={__name:"README",setup(e,{expose:s}){return s({frontmatter:{}}),(h,d)=>(a(),n("div",l,c))}};export{j as default};