Skip to content

Commit

Permalink
dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
myliang committed Dec 7, 2023
1 parent 4000c3e commit 74e5c46
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
14 changes: 11 additions & 3 deletions examples/components/DemoDropdown.vue
Original file line number Diff line number Diff line change
@@ -1,37 +1,46 @@
<template>
<main-layout menuActiveIndex="dropdown">
<h3>Dropdown</h3>
<fish-card fluid>
<fish-dropdown>
<a slot="title">Link<i class="fa fa-arrow-circle-down" style="margin-left: 10px;"></i></a>
<fish-menu>
<fish-option index="0" content="Jack"></fish-option>
<fish-option index="1" content="Lucy"></fish-option>
<fish-option index="2" content="Active"></fish-option>
<fish-option index="3" disabled content="disabled"></fish-option>
</fish-menu>
</fish-dropdown>
<fish-dropdown>
<fish-button slot="title">BL<i class="fa fa-angle-down" style="margin-left: 10px;"></i></fish-button>
<fish-menu>
<fish-option index="0" content="<a href='http://www.baidu.com' target='_blank'>Jack</a>"></fish-option>
<fish-option index="1" content="Lucy"></fish-option>
<fish-option index="2" content="Active"></fish-option>
<fish-option index="3" disabled content="disabled"></fish-option>
</fish-menu>
</fish-dropdown>
<fish-dropdown align="bottom-right">
<fish-button slot="title">BR<i class="fa fa-angle-down" style="margin-left: 10px;"></i></fish-button>
<fish-menu>
<fish-option index="1" content="Lucy"></fish-option>
<fish-option index="2" content="Active"></fish-option>
</fish-menu>
</fish-dropdown>
<fish-dropdown align="top-left">
<fish-button slot="title">TL<i class="fa fa-angle-down" style="margin-left: 10px;"></i></fish-button>
<fish-menu>
<fish-option index="1" content="Lucy"></fish-option>
<fish-option index="2" content="Active"></fish-option>
</fish-menu>
</fish-dropdown>
<fish-dropdown align="top-right">
<fish-button slot="title">TR<i class="fa fa-angle-down" style="margin-left: 10px;"></i></fish-button>
<fish-menu>
<fish-option index="1" content="Lucy"></fish-option>
<fish-option index="2" content="Active"></fish-option>
</fish-menu>
</fish-dropdown>
<footer slot="footer">
<footer>
<pre v-highlightjs><code class="html">&lt;fish-dropdown&gt;
&lt;a slot=&quot;title&quot;&gt;Link&lt;i class=&quot;fa fa-arrow-circle-down&quot; style=&quot;margin-left: 10px;&quot;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;fish-option index=&quot;0&quot; content=&quot;Jack&quot;&gt;&lt;/fish-option&gt;
Expand Down Expand Up @@ -62,7 +71,6 @@
&lt;fish-option index=&quot;2&quot; content=&quot;Active&quot;&gt;&lt;/fish-option&gt;
&lt;/fish-dropdown&gt;</code></pre>
</footer>
</fish-card>
</main-layout>
</template>
<script>
Expand Down
6 changes: 2 additions & 4 deletions src/components/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
@click="clickHandler"
v-clickoutside="awayHandler">
<slot name="title"></slot>
<fish-menu v-show="visible" class="content" @click="menusClickHandler">
<div v-show="visible" class="content" @click="menusClickHandler">
<slot></slot>
</fish-menu>
</div>
</div>
</template>
<script>
import clickoutside from '../directives/clickoutside'
import fishMenu from './Menu'
export default {
components: {fishMenu},
directives: { clickoutside },
name: 'fish-dropdown',
props: {
Expand Down

0 comments on commit 74e5c46

Please sign in to comment.