Skip to content

Commit

Permalink
iOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
michitaro committed Feb 7, 2019
1 parent ebda134 commit d901632
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/menubaritem/script.ts
Expand Up @@ -7,21 +7,25 @@ import { MenubaritemActivateEvent, MenuCloseEvent, MenubarDactivateEvent } from
import { MenuStyle, MENU_STYLE_KEY } from "../style"


export const MENUBARITEM_KEY = '@hscmap/vue-menu/menubaritem'


@Component({
components: { XMenu: Menu }
components: { XMenu: Menu },
provide() { return { [MENUBARITEM_KEY]: this } }
})
export class MenubaritemType extends Vue {
@Prop({ type: String, required: true })
label!: string
private label!: string

@Inject(MENUBAR_KEY)
menubar!: MenubarType
private menubar!: MenubarType

@Inject(MENU_STYLE_KEY)
menuStyle!: MenuStyle
private menuStyle!: MenuStyle

hover = false
isOpen = false
private hover = false
private isOpen = false

mounted() {
this.menu().$on(MenuCloseEvent.type, (e: MenuCloseEvent) => {
Expand All @@ -40,6 +44,12 @@ export class MenubaritemType extends Vue {
})
}

onMenuiatemFired() {
setTimeout(() => {
this.hover = false
}, 200)
}

get style() {
return this.active ? this.menuStyle.active : {}
}
Expand Down
5 changes: 5 additions & 0 deletions src/menuitem/script.ts
Expand Up @@ -5,6 +5,7 @@ import { sync } from "../global";
import { Keybinder } from "../keybinder";
import Menu from "../menu/index.vue";
import { MenuType, PADDING, PARENT_MENU_KEY } from "../menu/script";
import { MenubaritemType, MENUBARITEM_KEY } from "../menubaritem/script";
import { MenuStyle, MENU_STYLE_KEY } from "../style";


Expand All @@ -21,6 +22,9 @@ export class MenuitemType extends Vue {
@Inject(MENU_STYLE_KEY)
menuStyle!: MenuStyle

@Inject(MENUBARITEM_KEY)
menubaritem?: MenubaritemType

@Prop({ type: String, default: "" })
label!: string

Expand Down Expand Up @@ -133,6 +137,7 @@ export class MenuitemType extends Vue {
this.$emit('input', !this.vModel)
}
}
this.menubaritem && this.menubaritem.onMenuiatemFired()
}

private async flash() {
Expand Down
1 change: 1 addition & 0 deletions standalone/src/example.html
Expand Up @@ -2,6 +2,7 @@
<html lang="en">

<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>VueMenu standalone</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.2/dist/vue.js"></script>
<script src="./vue-menu-standalone.js"></script>
Expand Down

0 comments on commit d901632

Please sign in to comment.