mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 05:42:44 +08:00
2 lines
8.5 KiB
JavaScript
2 lines
8.5 KiB
JavaScript
/*! For license information please see 1113.2bada046.js.LICENSE.txt */
|
|
(self.webpackChunk=self.webpackChunk||[]).push([["1113"],{4721:function(n,s,t){"use strict";t.r(s);var a=t("80681");let d=["innerHTML"];s.default={setup:()=>({html:""}),render:()=>((0,a.wg)(),(0,a.iD)("div",{class:"van-doc-markdown-body",innerHTML:'<h1>ContactList \u8054\u7CFB\u4EBA\u5217\u8868</h1>\n<div class="van-doc-card"><h3 id="jie-shao" tabindex="-1">\u4ECB\u7ECD</h3>\n<p>\u5C55\u793A\u8054\u7CFB\u4EBA\u5217\u8868\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_">ContactList</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_">ContactList</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<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-contact-list</span>\n <span class="hljs-attr">v-model</span>=<span class="hljs-string">"chosenContactId"</span>\n <span class="hljs-attr">:list</span>=<span class="hljs-string">"list"</span>\n <span class="hljs-attr">default-tag-text</span>=<span class="hljs-string">"\u9ED8\u8BA4"</span>\n @<span class="hljs-attr">add</span>=<span class="hljs-string">"onAdd"</span>\n @<span class="hljs-attr">edit</span>=<span class="hljs-string">"onEdit"</span>\n @<span class="hljs-attr">select</span>=<span class="hljs-string">"onSelect"</span>\n/></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<span class="hljs-keyword">import</span> { showToast } <span class="hljs-keyword">from</span> <span class="hljs-string">'vant'</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> chosenContactId = <span class="hljs-title function_">ref</span>(<span class="hljs-string">'1'</span>);\n <span class="hljs-keyword">const</span> list = <span class="hljs-title function_">ref</span>([\n {\n <span class="hljs-attr">id</span>: <span class="hljs-string">'1'</span>,\n <span class="hljs-attr">name</span>: <span class="hljs-string">'\u5F20\u4E09'</span>,\n <span class="hljs-attr">tel</span>: <span class="hljs-string">'13000000000'</span>,\n <span class="hljs-attr">isDefault</span>: <span class="hljs-literal">true</span>,\n },\n {\n <span class="hljs-attr">id</span>: <span class="hljs-string">'2'</span>,\n <span class="hljs-attr">name</span>: <span class="hljs-string">'\u674E\u56DB'</span>,\n <span class="hljs-attr">tel</span>: <span class="hljs-string">'1310000000'</span>,\n },\n ]);\n\n <span class="hljs-keyword">const</span> <span class="hljs-title function_">onAdd</span> = (<span class="hljs-params"></span>) => <span class="hljs-title function_">showToast</span>(<span class="hljs-string">'\u65B0\u589E'</span>);\n <span class="hljs-keyword">const</span> <span class="hljs-title function_">onEdit</span> = (<span class="hljs-params">contact</span>) => <span class="hljs-title function_">showToast</span>(<span class="hljs-string">'\u7F16\u8F91'</span> + contact.<span class="hljs-property">id</span>);\n <span class="hljs-keyword">const</span> <span class="hljs-title function_">onSelect</span> = (<span class="hljs-params">contact</span>) => <span class="hljs-title function_">showToast</span>(<span class="hljs-string">'\u9009\u62E9'</span> + contact.<span class="hljs-property">id</span>);\n\n <span class="hljs-keyword">return</span> {\n list,\n onAdd,\n onEdit,\n onSelect,\n chosenContactId,\n };\n },\n};\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>v-model</td>\n<td>\u5F53\u524D\u9009\u4E2D\u8054\u7CFB\u4EBA\u7684 id</td>\n<td><em>number | string</em></td>\n<td>-</td>\n</tr>\n<tr>\n<td>list</td>\n<td>\u8054\u7CFB\u4EBA\u5217\u8868</td>\n<td><em>ContactListItem[]</em></td>\n<td><code>[]</code></td>\n</tr>\n<tr>\n<td>add-text</td>\n<td>\u65B0\u5EFA\u6309\u94AE\u6587\u6848</td>\n<td><em>string</em></td>\n<td><code>\u65B0\u5EFA\u8054\u7CFB\u4EBA</code></td>\n</tr>\n<tr>\n<td>default-tag-text</td>\n<td>\u9ED8\u8BA4\u8054\u7CFB\u4EBA\u6807\u7B7E\u6587\u6848</td>\n<td><em>string</em></td>\n<td>-</td>\n</tr>\n</tbody>\n</table>\n</div><div class="van-doc-card"><h3 id="events" tabindex="-1">Events</h3>\n<table>\n<thead>\n<tr>\n<th>\u4E8B\u4EF6\u540D</th>\n<th>\u8BF4\u660E</th>\n<th>\u56DE\u8C03\u53C2\u6570</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>add</td>\n<td>\u70B9\u51FB\u65B0\u589E\u6309\u94AE\u65F6\u89E6\u53D1</td>\n<td>-</td>\n</tr>\n<tr>\n<td>edit</td>\n<td>\u70B9\u51FB\u7F16\u8F91\u6309\u94AE\u65F6\u89E6\u53D1</td>\n<td><em>contact: ContactListItem\uFF0Cindex: number</em></td>\n</tr>\n<tr>\n<td>select</td>\n<td>\u5207\u6362\u9009\u4E2D\u7684\u8054\u7CFB\u4EBA\u65F6\u89E6\u53D1</td>\n<td><em>contact: ContactListItem\uFF0Cindex: number</em></td>\n</tr>\n</tbody>\n</table>\n</div><div class="van-doc-card"><h3 id="contactlistitem-shu-ju-jie-gou" tabindex="-1">ContactListItem \u6570\u636E\u7ED3\u6784</h3>\n<table>\n<thead>\n<tr>\n<th>\u952E\u540D</th>\n<th>\u8BF4\u660E</th>\n<th>\u7C7B\u578B</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>id</td>\n<td>\u6BCF\u4F4D\u8054\u7CFB\u4EBA\u7684\u552F\u4E00\u6807\u8BC6</td>\n<td><em>number | string</em></td>\n</tr>\n<tr>\n<td>name</td>\n<td>\u8054\u7CFB\u4EBA\u59D3\u540D</td>\n<td><em>string</em></td>\n</tr>\n<tr>\n<td>tel</td>\n<td>\u8054\u7CFB\u4EBA\u624B\u673A\u53F7</td>\n<td><em>number | string</em></td>\n</tr>\n<tr>\n<td>isDefault</td>\n<td>\u662F\u5426\u4E3A\u9ED8\u8BA4\u8054\u7CFB\u4EBA</td>\n<td><em>boolean | undefined</em></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_">ContactListItem</span>, <span class="hljs-title class_">ContactListProps</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'vant'</span>;\n</code></pre>\n</div><h2 id="zhu-ti-ding-zhi" tabindex="-1">\u4E3B\u9898\u5B9A\u5236</h2>\n<div class="van-doc-card"><h3 id="yang-shi-bian-liang" tabindex="-1">\u6837\u5F0F\u53D8\u91CF</h3>\n<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>\n<table>\n<thead>\n<tr>\n<th>\u540D\u79F0</th>\n<th>\u9ED8\u8BA4\u503C</th>\n<th>\u63CF\u8FF0</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>--van-contact-list-padding</td>\n<td><em>var(--van-padding-sm) var(--van-padding-sm) 80px</em></td>\n<td>-</td>\n</tr>\n<tr>\n<td>--van-contact-list-edit-icon-size</td>\n<td><em>16px</em></td>\n<td>-</td>\n</tr>\n<tr>\n<td>--van-contact-list-add-button-z-index</td>\n<td><em>999</em></td>\n<td>-</td>\n</tr>\n<tr>\n<td>--van-contact-list-radio-color</td>\n<td><em>var(--van-primary-color)</em></td>\n<td>-</td>\n</tr>\n<tr>\n<td>--van-contact-list-item-padding</td>\n<td><em>var(--van-padding-md)</em></td>\n<td>-</td>\n</tr>\n</tbody>\n</table>\n</div>'},null,8,d))}}}]); |