mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
113 lines
23 KiB
JavaScript
113 lines
23 KiB
JavaScript
import{o as a,a as t,y as n}from"./vue-libs.b44bc779.js";const l={class:"van-doc-markdown-body"},p=n(`<h1>DropdownMenu \u4E0B\u62C9\u83DC\u5355</h1><div class="van-doc-card"><h3 id="jie-shao" tabindex="-1">\u4ECB\u7ECD</h3><p>\u5411\u4E0B\u5F39\u51FA\u7684\u83DC\u5355\u5217\u8868\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">'vue'</span>;
|
|
<span class="hljs-keyword">import</span> { <span class="hljs-title class_">DropdownMenu</span>, <span class="hljs-title class_">DropdownItem</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'vant'</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_">DropdownMenu</span>);
|
|
app.<span class="hljs-title function_">use</span>(<span class="hljs-title class_">DropdownItem</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><pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-dropdown-menu</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-dropdown-item</span> <span class="hljs-attr">v-model</span>=<span class="hljs-string">"value1"</span> <span class="hljs-attr">:options</span>=<span class="hljs-string">"option1"</span> /></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-dropdown-item</span> <span class="hljs-attr">v-model</span>=<span class="hljs-string">"value2"</span> <span class="hljs-attr">:options</span>=<span class="hljs-string">"option2"</span> /></span>
|
|
<span class="hljs-tag"></<span class="hljs-name">van-dropdown-menu</span>></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">'vue'</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> value1 = <span class="hljs-title function_">ref</span>(<span class="hljs-number">0</span>);
|
|
<span class="hljs-keyword">const</span> value2 = <span class="hljs-title function_">ref</span>(<span class="hljs-string">'a'</span>);
|
|
<span class="hljs-keyword">const</span> option1 = [
|
|
{ <span class="hljs-attr">text</span>: <span class="hljs-string">'\u5168\u90E8\u5546\u54C1'</span>, <span class="hljs-attr">value</span>: <span class="hljs-number">0</span> },
|
|
{ <span class="hljs-attr">text</span>: <span class="hljs-string">'\u65B0\u6B3E\u5546\u54C1'</span>, <span class="hljs-attr">value</span>: <span class="hljs-number">1</span> },
|
|
{ <span class="hljs-attr">text</span>: <span class="hljs-string">'\u6D3B\u52A8\u5546\u54C1'</span>, <span class="hljs-attr">value</span>: <span class="hljs-number">2</span> },
|
|
];
|
|
<span class="hljs-keyword">const</span> option2 = [
|
|
{ <span class="hljs-attr">text</span>: <span class="hljs-string">'\u9ED8\u8BA4\u6392\u5E8F'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'a'</span> },
|
|
{ <span class="hljs-attr">text</span>: <span class="hljs-string">'\u597D\u8BC4\u6392\u5E8F'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'b'</span> },
|
|
{ <span class="hljs-attr">text</span>: <span class="hljs-string">'\u9500\u91CF\u6392\u5E8F'</span>, <span class="hljs-attr">value</span>: <span class="hljs-string">'c'</span> },
|
|
];
|
|
|
|
<span class="hljs-keyword">return</span> {
|
|
value1,
|
|
value2,
|
|
option1,
|
|
option2,
|
|
};
|
|
},
|
|
};
|
|
</code></pre></div><div class="van-doc-card"><h3 id="zi-ding-yi-cai-dan-nei-rong" tabindex="-1">\u81EA\u5B9A\u4E49\u83DC\u5355\u5185\u5BB9</h3><p>\u901A\u8FC7\u63D2\u69FD\u53EF\u4EE5\u81EA\u5B9A\u4E49 <code>DropdownItem</code> \u7684\u5185\u5BB9\uFF0C\u6B64\u65F6\u9700\u8981\u4F7F\u7528\u5B9E\u4F8B\u4E0A\u7684 <code>toggle</code> \u65B9\u6CD5\u624B\u52A8\u63A7\u5236\u83DC\u5355\u7684\u663E\u793A\u3002</p><pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-dropdown-menu</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-dropdown-item</span> <span class="hljs-attr">v-model</span>=<span class="hljs-string">"value"</span> <span class="hljs-attr">:options</span>=<span class="hljs-string">"options"</span> /></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-dropdown-item</span> <span class="hljs-attr">title</span>=<span class="hljs-string">"\u7B5B\u9009"</span> <span class="hljs-attr">ref</span>=<span class="hljs-string">"item"</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-cell</span> <span class="hljs-attr">center</span> <span class="hljs-attr">title</span>=<span class="hljs-string">"\u5305\u90AE"</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">template</span> #<span class="hljs-attr">right-icon</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-switch</span> <span class="hljs-attr">v-model</span>=<span class="hljs-string">"switch1"</span> <span class="hljs-attr">size</span>=<span class="hljs-string">"24"</span> <span class="hljs-attr">active-color</span>=<span class="hljs-string">"#ee0a24"</span> /></span>
|
|
<span class="hljs-tag"></<span class="hljs-name">template</span>></span>
|
|
<span class="hljs-tag"></<span class="hljs-name">van-cell</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-cell</span> <span class="hljs-attr">center</span> <span class="hljs-attr">title</span>=<span class="hljs-string">"\u56E2\u8D2D"</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">template</span> #<span class="hljs-attr">right-icon</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-switch</span> <span class="hljs-attr">v-model</span>=<span class="hljs-string">"switch2"</span> <span class="hljs-attr">size</span>=<span class="hljs-string">"24"</span> <span class="hljs-attr">active-color</span>=<span class="hljs-string">"#ee0a24"</span> /></span>
|
|
<span class="hljs-tag"></<span class="hljs-name">template</span>></span>
|
|
<span class="hljs-tag"></<span class="hljs-name">van-cell</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"padding: 5px 16px;"</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"danger"</span> <span class="hljs-attr">block</span> <span class="hljs-attr">round</span> @<span class="hljs-attr">click</span>=<span class="hljs-string">"onConfirm"</span>></span>
|
|
\u786E\u8BA4
|
|
<span class="hljs-tag"></<span class="hljs-name">van-button</span>></span>
|
|
<span class="hljs-tag"></<span class="hljs-name">div</span>></span>
|
|
<span class="hljs-tag"></<span class="hljs-name">van-dropdown-item</span>></span>
|
|
<span class="hljs-tag"></<span class="hljs-name">van-dropdown-menu</span>></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">'vue'</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> item = <span class="hljs-title function_">ref</span>(<span class="hljs-literal">null</span>);
|
|
<span class="hljs-keyword">const</span> value = <span class="hljs-title function_">ref</span>(<span class="hljs-number">0</span>);
|
|
<span class="hljs-keyword">const</span> switch1 = <span class="hljs-title function_">ref</span>(<span class="hljs-literal">false</span>);
|
|
<span class="hljs-keyword">const</span> switch2 = <span class="hljs-title function_">ref</span>(<span class="hljs-literal">false</span>);
|
|
<span class="hljs-keyword">const</span> options = [
|
|
{ <span class="hljs-attr">text</span>: <span class="hljs-string">'\u5168\u90E8\u5546\u54C1'</span>, <span class="hljs-attr">value</span>: <span class="hljs-number">0</span> },
|
|
{ <span class="hljs-attr">text</span>: <span class="hljs-string">'\u65B0\u6B3E\u5546\u54C1'</span>, <span class="hljs-attr">value</span>: <span class="hljs-number">1</span> },
|
|
{ <span class="hljs-attr">text</span>: <span class="hljs-string">'\u6D3B\u52A8\u5546\u54C1'</span>, <span class="hljs-attr">value</span>: <span class="hljs-number">2</span> },
|
|
];
|
|
<span class="hljs-keyword">const</span> <span class="hljs-title function_">onConfirm</span> = (<span class="hljs-params"></span>) => {
|
|
item.<span class="hljs-property">value</span>.<span class="hljs-title function_">toggle</span>();
|
|
};
|
|
|
|
<span class="hljs-keyword">return</span> {
|
|
item,
|
|
value,
|
|
switch1,
|
|
switch2,
|
|
options,
|
|
onConfirm,
|
|
};
|
|
},
|
|
};
|
|
</code></pre></div><div class="van-doc-card"><h3 id="zi-ding-yi-xuan-zhong-tai-yan-se" tabindex="-1">\u81EA\u5B9A\u4E49\u9009\u4E2D\u6001\u989C\u8272</h3><p>\u901A\u8FC7 <code>active-color</code> \u5C5E\u6027\u53EF\u4EE5\u81EA\u5B9A\u4E49\u83DC\u5355\u6807\u9898\u548C\u9009\u9879\u7684\u9009\u4E2D\u6001\u989C\u8272\u3002</p><pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-dropdown-menu</span> <span class="hljs-attr">active-color</span>=<span class="hljs-string">"#1989fa"</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-dropdown-item</span> <span class="hljs-attr">v-model</span>=<span class="hljs-string">"value1"</span> <span class="hljs-attr">:options</span>=<span class="hljs-string">"option1"</span> /></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-dropdown-item</span> <span class="hljs-attr">v-model</span>=<span class="hljs-string">"value2"</span> <span class="hljs-attr">:options</span>=<span class="hljs-string">"option2"</span> /></span>
|
|
<span class="hljs-tag"></<span class="hljs-name">van-dropdown-menu</span>></span>
|
|
</code></pre></div><div class="van-doc-card"><h3 id="xiang-shang-zhan-kai" tabindex="-1">\u5411\u4E0A\u5C55\u5F00</h3><p>\u5C06 <code>direction</code> \u5C5E\u6027\u503C\u8BBE\u7F6E\u4E3A <code>up</code>\uFF0C\u83DC\u5355\u5373\u53EF\u5411\u4E0A\u5C55\u5F00\u3002</p><pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-dropdown-menu</span> <span class="hljs-attr">direction</span>=<span class="hljs-string">"up"</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-dropdown-item</span> <span class="hljs-attr">v-model</span>=<span class="hljs-string">"value1"</span> <span class="hljs-attr">:options</span>=<span class="hljs-string">"option1"</span> /></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-dropdown-item</span> <span class="hljs-attr">v-model</span>=<span class="hljs-string">"value2"</span> <span class="hljs-attr">:options</span>=<span class="hljs-string">"option2"</span> /></span>
|
|
<span class="hljs-tag"></<span class="hljs-name">van-dropdown-menu</span>></span>
|
|
</code></pre></div><div class="van-doc-card"><h3 id="jin-yong-cai-dan" tabindex="-1">\u7981\u7528\u83DC\u5355</h3><pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-dropdown-menu</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-dropdown-item</span> <span class="hljs-attr">v-model</span>=<span class="hljs-string">"value1"</span> <span class="hljs-attr">disabled</span> <span class="hljs-attr">:options</span>=<span class="hljs-string">"option1"</span> /></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-dropdown-item</span> <span class="hljs-attr">v-model</span>=<span class="hljs-string">"value2"</span> <span class="hljs-attr">disabled</span> <span class="hljs-attr">:options</span>=<span class="hljs-string">"option2"</span> /></span>
|
|
<span class="hljs-tag"></<span class="hljs-name">van-dropdown-menu</span>></span>
|
|
</code></pre></div><h2 id="api" tabindex="-1">API</h2><div class="van-doc-card"><h3 id="dropdownmenu-props" tabindex="-1">DropdownMenu 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>active-color</td><td>\u83DC\u5355\u6807\u9898\u548C\u9009\u9879\u7684\u9009\u4E2D\u6001\u989C\u8272</td><td><em>string</em></td><td><code>#ee0a24</code></td></tr><tr><td>direction</td><td>\u83DC\u5355\u5C55\u5F00\u65B9\u5411\uFF0C\u53EF\u9009\u503C\u4E3A<code>up</code></td><td><em>string</em></td><td><code>down</code></td></tr><tr><td>z-index</td><td>\u83DC\u5355\u680F z-index \u5C42\u7EA7</td><td><em>number | string</em></td><td><code>10</code></td></tr><tr><td>duration</td><td>\u52A8\u753B\u65F6\u957F\uFF0C\u5355\u4F4D\u79D2\uFF0C\u8BBE\u7F6E\u4E3A 0 \u53EF\u4EE5\u7981\u7528\u52A8\u753B</td><td><em>number | string</em></td><td><code>0.2</code></td></tr><tr><td>overlay</td><td>\u662F\u5426\u663E\u793A\u906E\u7F69\u5C42</td><td><em>boolean</em></td><td><code>true</code></td></tr><tr><td>close-on-click-overlay</td><td>\u662F\u5426\u5728\u70B9\u51FB\u906E\u7F69\u5C42\u540E\u5173\u95ED\u83DC\u5355</td><td><em>boolean</em></td><td><code>true</code></td></tr><tr><td>close-on-click-outside</td><td>\u662F\u5426\u5728\u70B9\u51FB\u5916\u90E8\u5143\u7D20\u540E\u5173\u95ED\u83DC\u5355</td><td><em>boolean</em></td><td><code>true</code></td></tr></tbody></table></div><div class="van-doc-card"><h3 id="dropdownitem-props" tabindex="-1">DropdownItem 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\u9009\u4E2D\u9879\u5BF9\u5E94\u7684 value</td><td><em>number | string</em></td><td>-</td></tr><tr><td>title</td><td>\u83DC\u5355\u9879\u6807\u9898</td><td><em>string</em></td><td>\u5F53\u524D\u9009\u4E2D\u9879\u6587\u5B57</td></tr><tr><td>options</td><td>\u9009\u9879\u6570\u7EC4</td><td><em>Option[]</em></td><td><code>[]</code></td></tr><tr><td>disabled</td><td>\u662F\u5426\u7981\u7528\u83DC\u5355</td><td><em>boolean</em></td><td><code>false</code></td></tr><tr><td>lazy-render</td><td>\u662F\u5426\u5728\u9996\u6B21\u5C55\u5F00\u65F6\u624D\u6E32\u67D3\u83DC\u5355\u5185\u5BB9</td><td><em>boolean</em></td><td><code>true</code></td></tr><tr><td>title-class</td><td>\u6807\u9898\u989D\u5916\u7C7B\u540D</td><td><em>string | Array | object</em></td><td>-</td></tr><tr><td>teleport</td><td>\u6307\u5B9A\u6302\u8F7D\u7684\u8282\u70B9\uFF0C\u7B49\u540C\u4E8E Teleport \u7EC4\u4EF6\u7684 <a href="https://v3.cn.vuejs.org/api/built-in-components.html#teleport" target="_blank">to \u5C5E\u6027</a></td><td><em>string | Element</em></td><td>-</td></tr></tbody></table></div><div class="van-doc-card"><h3 id="dropdownitem-events" tabindex="-1">DropdownItem 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>\u70B9\u51FB\u9009\u9879\u5BFC\u81F4 value \u53D8\u5316\u65F6\u89E6\u53D1</td><td>value</td></tr><tr><td>open</td><td>\u6253\u5F00\u83DC\u5355\u680F\u65F6\u89E6\u53D1</td><td>-</td></tr><tr><td>close</td><td>\u5173\u95ED\u83DC\u5355\u680F\u65F6\u89E6\u53D1</td><td>-</td></tr><tr><td>opened</td><td>\u6253\u5F00\u83DC\u5355\u680F\u4E14\u52A8\u753B\u7ED3\u675F\u540E\u89E6\u53D1</td><td>-</td></tr><tr><td>closed</td><td>\u5173\u95ED\u83DC\u5355\u680F\u4E14\u52A8\u753B\u7ED3\u675F\u540E\u89E6\u53D1</td><td>-</td></tr></tbody></table></div><div class="van-doc-card"><h3 id="dropdownitem-slots" tabindex="-1">DropdownItem Slots</h3><table><thead><tr><th>\u540D\u79F0</th><th>\u8BF4\u660E</th></tr></thead><tbody><tr><td>default</td><td>\u83DC\u5355\u5185\u5BB9</td></tr><tr><td>title</td><td>\u81EA\u5B9A\u4E49\u83DC\u5355\u9879\u6807\u9898</td></tr></tbody></table></div><div class="van-doc-card"><h3 id="dropdownitem-fang-fa" tabindex="-1">DropdownItem \u65B9\u6CD5</h3><p>\u901A\u8FC7 ref \u53EF\u4EE5\u83B7\u53D6\u5230 DropdownItem \u5B9E\u4F8B\u5E76\u8C03\u7528\u5B9E\u4F8B\u65B9\u6CD5\uFF0C\u8BE6\u89C1<a href="#/zh-CN/advanced-usage#zu-jian-shi-li-fang-fa" target="_blank">\u7EC4\u4EF6\u5B9E\u4F8B\u65B9\u6CD5</a>\u3002</p><table><thead><tr><th>\u65B9\u6CD5\u540D</th><th>\u8BF4\u660E</th><th>\u53C2\u6570</th><th>\u8FD4\u56DE\u503C</th></tr></thead><tbody><tr><td>toggle</td><td>\u5207\u6362\u83DC\u5355\u5C55\u793A\u72B6\u6001\uFF0C\u4F20 <code>true</code> \u4E3A\u663E\u793A\uFF0C<code>false</code> \u4E3A\u9690\u85CF\uFF0C\u4E0D\u4F20\u53C2\u4E3A\u53D6\u53CD</td><td><em>show?: boolean</em></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_">DropdownMenuProps</span>,
|
|
<span class="hljs-title class_">DropdownItemProps</span>,
|
|
<span class="hljs-title class_">DropdownItemOption</span>,
|
|
<span class="hljs-title class_">DropdownItemInstance</span>,
|
|
<span class="hljs-title class_">DropdownMenuDirection</span>,
|
|
} <span class="hljs-keyword">from</span> <span class="hljs-string">'vant'</span>;
|
|
</code></pre><p><code>DropdownItemInstance</code> \u662F\u7EC4\u4EF6\u5B9E\u4F8B\u7684\u7C7B\u578B\uFF0C\u7528\u6CD5\u5982\u4E0B\uFF1A</p><pre><code class="language-ts"><span class="hljs-keyword">import</span> { ref } <span class="hljs-keyword">from</span> <span class="hljs-string">'vue'</span>;
|
|
<span class="hljs-keyword">import</span> <span class="hljs-keyword">type</span> { <span class="hljs-title class_">DropdownItemInstance</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'vant'</span>;
|
|
|
|
<span class="hljs-keyword">const</span> dropdownItemRef = ref<<span class="hljs-title class_">DropdownItemInstance</span>>();
|
|
|
|
dropdownItemRef.<span class="hljs-property">value</span>?.<span class="hljs-title function_">toggle</span>();
|
|
</code></pre></div><div class="van-doc-card"><h3 id="option-shu-ju-jie-gou" tabindex="-1">Option \u6570\u636E\u7ED3\u6784</h3><table><thead><tr><th>\u952E\u540D</th><th>\u8BF4\u660E</th><th>\u7C7B\u578B</th></tr></thead><tbody><tr><td>text</td><td>\u6587\u5B57</td><td><em>string</em></td></tr><tr><td>value</td><td>\u6807\u8BC6\u7B26</td><td><em>number | string</em></td></tr><tr><td>icon</td><td>\u5DE6\u4FA7\u56FE\u6807\u540D\u79F0\u6216\u56FE\u7247\u94FE\u63A5\uFF0C\u7B49\u540C\u4E8E Icon \u7EC4\u4EF6\u7684 <a href="#/zh-CN/icon#props" target="_blank">name \u5C5E\u6027</a></td><td><em>string</em></td></tr></tbody></table></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-dropdown-menu-height</td><td><em>48px</em></td><td>-</td></tr><tr><td>--van-dropdown-menu-background-color</td><td><em>var(--van-background-color-light)</em></td><td>-</td></tr><tr><td>--van-dropdown-menu-box-shadow</td><td><em>0 2px 12px fade(var(--van-gray-7), 12)</em></td><td>-</td></tr><tr><td>--van-dropdown-menu-title-font-size</td><td><em>15px</em></td><td>-</td></tr><tr><td>--van-dropdown-menu-title-text-color</td><td><em>var(--van-text-color)</em></td><td>-</td></tr><tr><td>--van-dropdown-menu-title-active-text-color</td><td><em>var(--van-danger-color)</em></td><td>-</td></tr><tr><td>--van-dropdown-menu-title-disabled-text-color</td><td><em>var(--van-text-color-2)</em></td><td>-</td></tr><tr><td>--van-dropdown-menu-title-padding</td><td><em>0 var(--van-padding-xs)</em></td><td>-</td></tr><tr><td>--van-dropdown-menu-title-line-height</td><td><em>var(--van-line-height-lg)</em></td><td>-</td></tr><tr><td>--van-dropdown-menu-option-active-color</td><td><em>var(--van-danger-color)</em></td><td>-</td></tr><tr><td>--van-dropdown-menu-content-max-height</td><td><em>80%</em></td><td>-</td></tr><tr><td>--van-dropdown-item-z-index</td><td><em>10</em></td><td>-</td></tr></tbody></table></div><h2 id="chang-jian-wen-ti" tabindex="-1">\u5E38\u89C1\u95EE\u9898</h2><div class="van-doc-card"><h3 id="fu-yuan-su-she-zhi-transform-hou-xia-la-cai-dan-de-wei-zhi-cuo-wu" tabindex="-1">\u7236\u5143\u7D20\u8BBE\u7F6E transform \u540E\uFF0C\u4E0B\u62C9\u83DC\u5355\u7684\u4F4D\u7F6E\u9519\u8BEF\uFF1F</h3><p>\u628A <code>DropdownMenu</code> \u5D4C\u5957\u5728 <code>Tabs</code> \u7B49\u7EC4\u4EF6\u5185\u90E8\u4F7F\u7528\u65F6\uFF0C\u53EF\u80FD\u4F1A\u9047\u5230\u4E0B\u62C9\u83DC\u5355\u4F4D\u7F6E\u9519\u8BEF\u7684\u95EE\u9898\u3002\u8FD9\u662F\u56E0\u4E3A\u5728 Chrome \u6D4F\u89C8\u5668\u4E2D\uFF0Ctransform \u5143\u7D20\u5185\u90E8\u7684 fixed \u5E03\u5C40\u4F1A\u964D\u7EA7\u6210 absolute \u5E03\u5C40\uFF0C\u5BFC\u81F4\u4E0B\u62C9\u83DC\u5355\u7684\u5E03\u5C40\u5F02\u5E38\u3002</p><p>\u5C06 <code>DropdownItem</code> \u7684 <code>teleport</code> \u5C5E\u6027\u8BBE\u7F6E\u4E3A <code>body</code> \u5373\u53EF\u907F\u514D\u6B64\u95EE\u9898\uFF1A</p><pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-dropdown-menu</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-dropdown-item</span> <span class="hljs-attr">teleport</span>=<span class="hljs-string">"body"</span> /></span>
|
|
<span class="hljs-tag"><<span class="hljs-name">van-dropdown-item</span> <span class="hljs-attr">teleport</span>=<span class="hljs-string">"body"</span> /></span>
|
|
<span class="hljs-tag"></<span class="hljs-name">van-dropdown-menu</span>></span>
|
|
</code></pre></div>`,21),d=[p],i={__name:"README.zh-CN",setup(e,{expose:s}){return s({frontmatter:{}}),(c,r)=>(a(),t("div",l,d))}};export{i as default};
|