Skip to content

Commit

Permalink
fix:[Sidebar]: fixed bug in iOS (#1152)
Browse files Browse the repository at this point in the history
  • Loading branch information
PanJiaChen authored Sep 30, 2018
1 parent 616f173 commit 935d9aa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
26 changes: 26 additions & 0 deletions src/views/layout/components/Sidebar/FixiOSBug.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export default {
computed: {
device() {
return this.$store.state.app.device
}
},
mounted() {
// In order to fix the click on menu on the ios device will trigger the mouseeleave bug
// https://github.com/PanJiaChen/vue-element-admin/issues/1135
this.fixBugIniOS()
},
methods: {
fixBugIniOS() {
const $submenu = this.$refs.submenu
if ($submenu) {
const handleMouseleave = $submenu.handleMouseleave
$submenu.handleMouseleave = (e) => {
if (this.device === 'mobile') {
return
}
handleMouseleave(e)
}
}
}
}
}
4 changes: 3 additions & 1 deletion src/views/layout/components/Sidebar/SidebarItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</app-link>
</template>

<el-submenu v-else :index="item.name||item.path">
<el-submenu v-else ref="submenu" :index="item.name||item.path">
<template slot="title">
<item v-if="item.meta" :icon="item.meta.icon" :title="generateTitle(item.meta.title)" />
</template>
Expand Down Expand Up @@ -40,10 +40,12 @@ import { generateTitle } from '@/utils/i18n'
import { validateURL } from '@/utils/validate'
import Item from './Item'
import AppLink from './Link'
import FixiOSBug from './FixiOSBug'
export default {
name: 'SidebarItem',
components: { Item, AppLink },
mixins: [FixiOSBug],
props: {
// route object
item: {
Expand Down

0 comments on commit 935d9aa

Please sign in to comment.