vant/v3/assets/README.zh-CN.b54e797e.js
2024-04-20 08:49:23 +00:00

33 lines
9.9 KiB
JavaScript

import{o as t,a,y as n}from"./vue-libs.b44bc779.js";const d={class:"van-doc-markdown-body"},e=n(`<h1>Pagination \u5206\u9875</h1><div class="van-doc-card"><h3 id="jie-shao" tabindex="-1">\u4ECB\u7ECD</h3><p>\u6570\u636E\u91CF\u8FC7\u591A\u65F6\uFF0C\u91C7\u7528\u5206\u9875\u7684\u5F62\u5F0F\u5C06\u6570\u636E\u5206\u9694\uFF0C\u6BCF\u6B21\u53EA\u52A0\u8F7D\u4E00\u4E2A\u9875\u9762\u3002</p></div><div class="van-doc-card"><h3 id="yin-ru" tabindex="-1">\u5F15\u5165</h3><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><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_">Pagination</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_">Pagination</span>);
</code></pre></div><h2 id="dai-ma-yan-shi" tabindex="-1">\u4EE3\u7801\u6F14\u793A</h2><div class="van-doc-card"><h3 id="ji-chu-yong-fa" tabindex="-1">\u57FA\u7840\u7528\u6CD5</h3><p>\u901A\u8FC7 <code>v-model</code> \u6765\u7ED1\u5B9A\u5F53\u524D\u9875\u7801\u3002</p><pre><code class="language-html"><span class="hljs-tag">&lt;<span class="hljs-name">van-pagination</span> <span class="hljs-attr">v-model</span>=<span class="hljs-string">&quot;currentPage&quot;</span> <span class="hljs-attr">:total-items</span>=<span class="hljs-string">&quot;24&quot;</span> <span class="hljs-attr">:items-per-page</span>=<span class="hljs-string">&quot;5&quot;</span> /&gt;</span>
</code></pre><pre><code class="language-js"><span class="hljs-keyword">import</span> { ref } <span class="hljs-keyword">from</span> <span class="hljs-string">&#39;vue&#39;</span>;
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> {
<span class="hljs-title function_">setup</span>(<span class="hljs-params"></span>) {
<span class="hljs-keyword">const</span> currentPage = <span class="hljs-title function_">ref</span>(<span class="hljs-number">1</span>);
<span class="hljs-keyword">return</span> { currentPage };
},
};
</code></pre></div><div class="van-doc-card"><h3 id="jian-dan-mo-shi" tabindex="-1">\u7B80\u5355\u6A21\u5F0F</h3><p>\u5C06 <code>mode</code> \u8BBE\u7F6E\u4E3A <code>simple</code> \u6765\u5207\u6362\u5230\u7B80\u5355\u6A21\u5F0F\uFF0C\u6B64\u65F6\u5206\u9875\u5668\u4E0D\u4F1A\u5C55\u793A\u5177\u4F53\u7684\u9875\u7801\u6309\u94AE\u3002</p><pre><code class="language-html"><span class="hljs-tag">&lt;<span class="hljs-name">van-pagination</span> <span class="hljs-attr">v-model</span>=<span class="hljs-string">&quot;currentPage&quot;</span> <span class="hljs-attr">:page-count</span>=<span class="hljs-string">&quot;12&quot;</span> <span class="hljs-attr">mode</span>=<span class="hljs-string">&quot;simple&quot;</span> /&gt;</span>
</code></pre></div><div class="van-doc-card"><h3 id="xian-shi-sheng-lue-hao" tabindex="-1">\u663E\u793A\u7701\u7565\u53F7</h3><p>\u8BBE\u7F6E <code>force-ellipses</code> \u540E\u4F1A\u5C55\u793A\u7701\u7565\u53F7\u6309\u94AE\uFF0C\u70B9\u51FB\u540E\u53EF\u4EE5\u5FEB\u901F\u8DF3\u8F6C\u3002</p><pre><code class="language-html"><span class="hljs-tag">&lt;<span class="hljs-name">van-pagination</span>
<span class="hljs-attr">v-model</span>=<span class="hljs-string">&quot;currentPage&quot;</span>
<span class="hljs-attr">:total-items</span>=<span class="hljs-string">&quot;125&quot;</span>
<span class="hljs-attr">:show-page-size</span>=<span class="hljs-string">&quot;3&quot;</span>
<span class="hljs-attr">force-ellipses</span>
/&gt;</span>
</code></pre></div><div class="van-doc-card"><h3 id="zi-ding-yi-an-niu" tabindex="-1">\u81EA\u5B9A\u4E49\u6309\u94AE</h3><p>\u901A\u8FC7 <code>prev-text</code>\u3001<code>next-text</code> \u7B49\u63D2\u69FD\u6765\u81EA\u5B9A\u4E49\u5206\u9875\u6309\u94AE\u7684\u5185\u5BB9\u3002</p><pre><code class="language-html"><span class="hljs-tag">&lt;<span class="hljs-name">van-pagination</span> <span class="hljs-attr">v-model</span>=<span class="hljs-string">&quot;currentPage&quot;</span> <span class="hljs-attr">:total-items</span>=<span class="hljs-string">&quot;50&quot;</span> <span class="hljs-attr">:show-page-size</span>=<span class="hljs-string">&quot;5&quot;</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">template</span> #<span class="hljs-attr">prev-text</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-icon</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;arrow-left&quot;</span> /&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">template</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">template</span> #<span class="hljs-attr">next-text</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">van-icon</span> <span class="hljs-attr">name</span>=<span class="hljs-string">&quot;arrow&quot;</span> /&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">template</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">template</span> #<span class="hljs-attr">page</span>=<span class="hljs-string">&quot;{ text }&quot;</span>&gt;</span>{{ text }}<span class="hljs-tag">&lt;/<span class="hljs-name">template</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">van-pagination</span>&gt;</span>
</code></pre></div><h2 id="api" tabindex="-1">API</h2><div class="van-doc-card"><h3 id="props" tabindex="-1">Props</h3><table><thead><tr><th>\u53C2\u6570</th><th>\u8BF4\u660E</th><th>\u7C7B\u578B</th><th>\u9ED8\u8BA4\u503C</th></tr></thead><tbody><tr><td>v-model</td><td>\u5F53\u524D\u9875\u7801</td><td><em>number</em></td><td>-</td></tr><tr><td>mode</td><td>\u663E\u793A\u6A21\u5F0F\uFF0C\u53EF\u9009\u503C\u4E3A <code>simple</code></td><td><em>string</em></td><td><code>multi</code></td></tr><tr><td>prev-text</td><td>\u4E0A\u4E00\u9875\u6309\u94AE\u6587\u5B57</td><td><em>string</em></td><td><code>\u4E0A\u4E00\u9875</code></td></tr><tr><td>next-text</td><td>\u4E0B\u4E00\u9875\u6309\u94AE\u6587\u5B57</td><td><em>string</em></td><td><code>\u4E0B\u4E00\u9875</code></td></tr><tr><td>page-count</td><td>\u603B\u9875\u6570</td><td><em>number | string</em></td><td>\u6839\u636E\u9875\u6570\u8BA1\u7B97</td></tr><tr><td>total-items</td><td>\u603B\u8BB0\u5F55\u6570</td><td><em>number | string</em></td><td><code>0</code></td></tr><tr><td>items-per-page</td><td>\u6BCF\u9875\u8BB0\u5F55\u6570</td><td><em>number | string</em></td><td><code>10</code></td></tr><tr><td>show-page-size</td><td>\u663E\u793A\u7684\u9875\u7801\u4E2A\u6570</td><td><em>number | string</em></td><td><code>5</code></td></tr><tr><td>force-ellipses</td><td>\u662F\u5426\u663E\u793A\u7701\u7565\u53F7</td><td><em>boolean</em></td><td><code>false</code></td></tr></tbody></table></div><div class="van-doc-card"><h3 id="events" tabindex="-1">Events</h3><table><thead><tr><th>\u4E8B\u4EF6\u540D</th><th>\u8BF4\u660E</th><th>\u56DE\u8C03\u53C2\u6570</th></tr></thead><tbody><tr><td>change</td><td>\u9875\u7801\u6539\u53D8\u65F6\u89E6\u53D1</td><td>-</td></tr></tbody></table></div><div class="van-doc-card"><h3 id="slots" tabindex="-1">Slots</h3><table><thead><tr><th>\u540D\u79F0</th><th>\u63CF\u8FF0</th><th>\u53C2\u6570</th></tr></thead><tbody><tr><td>page</td><td>\u81EA\u5B9A\u4E49\u9875\u7801</td><td><em>{ number: number, text: string, active: boolean }</em></td></tr><tr><td>prev-text</td><td>\u81EA\u5B9A\u4E49\u4E0A\u4E00\u9875\u6309\u94AE\u6587\u5B57</td><td>-</td></tr><tr><td>next-text</td><td>\u81EA\u5B9A\u4E49\u4E0B\u4E00\u9875\u6309\u94AE\u6587\u5B57</td><td>-</td></tr></tbody></table></div><div class="van-doc-card"><h3 id="lei-xing-ding-yi" tabindex="-1">\u7C7B\u578B\u5B9A\u4E49</h3><p>\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A</p><pre><code class="language-ts"><span class="hljs-keyword">import</span> <span class="hljs-keyword">type</span> { <span class="hljs-title class_">PaginationMode</span>, <span class="hljs-title class_">PaginationProps</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">&#39;vant&#39;</span>;
</code></pre></div><h2 id="zhu-ti-ding-zhi" tabindex="-1">\u4E3B\u9898\u5B9A\u5236</h2><div class="van-doc-card"><h3 id="yang-shi-bian-liang" tabindex="-1">\u6837\u5F0F\u53D8\u91CF</h3><p>\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 <a href="#/zh-CN/config-provider" target="_blank">ConfigProvider \u7EC4\u4EF6</a>\u3002</p><table><thead><tr><th>\u540D\u79F0</th><th>\u9ED8\u8BA4\u503C</th><th>\u63CF\u8FF0</th></tr></thead><tbody><tr><td>--van-pagination-height</td><td><em>40px</em></td><td>-</td></tr><tr><td>--van-pagination-font-size</td><td><em>var(--van-font-size-md)</em></td><td>-</td></tr><tr><td>--van-pagination-item-width</td><td><em>36px</em></td><td>-</td></tr><tr><td>--van-pagination-item-default-color</td><td><em>var(--van-primary-color)</em></td><td>-</td></tr><tr><td>--van-pagination-item-disabled-color</td><td><em>var(--van-gray-7)</em></td><td>-</td></tr><tr><td>--van-pagination-item-disabled-background-color</td><td><em>var(--van-background-color)</em></td><td>-</td></tr><tr><td>--van-pagination-background-color</td><td><em>var(--van-background-color-light)</em></td><td>-</td></tr><tr><td>--van-pagination-desc-color</td><td><em>var(--van-gray-7)</em></td><td>-</td></tr><tr><td>--van-pagination-disabled-opacity</td><td><em>var(--van-disabled-opacity)</em></td><td>-</td></tr></tbody></table></div>`,15),l=[e],h={__name:"README.zh-CN",setup(p,{expose:s}){return s({frontmatter:{}}),(c,o)=>(t(),a("div",d,l))}};export{h as default};