diff --git a/src/views/layout/components/Sidebar/FixiOSBug.js b/src/views/layout/components/Sidebar/FixiOSBug.js new file mode 100644 index 00000000000..5e0a92624dd --- /dev/null +++ b/src/views/layout/components/Sidebar/FixiOSBug.js @@ -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) + } + } + } + } +} diff --git a/src/views/layout/components/Sidebar/SidebarItem.vue b/src/views/layout/components/Sidebar/SidebarItem.vue index 01401b0925f..e3abbd2d210 100644 --- a/src/views/layout/components/Sidebar/SidebarItem.vue +++ b/src/views/layout/components/Sidebar/SidebarItem.vue @@ -9,7 +9,7 @@ - + @@ -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: {