Menu: fix console error

pull/8136/head
Leopoldthecoder 2017-11-09 15:12:16 +08:00 committed by 杨奕
parent 73184399ed
commit cbfd9cfab3
1 changed files with 4 additions and 2 deletions

View File

@ -173,11 +173,13 @@
}, },
handleTitleMouseenter() { handleTitleMouseenter() {
if (this.mode === 'horizontal' && !this.rootMenu.backgroundColor) return; if (this.mode === 'horizontal' && !this.rootMenu.backgroundColor) return;
this.$refs['submenu-title'].style.backgroundColor = this.rootMenu.hoverBackground; const title = this.$refs['submenu-title'];
title && (title.style.backgroundColor = this.rootMenu.hoverBackground);
}, },
handleTitleMouseleave() { handleTitleMouseleave() {
if (this.mode === 'horizontal' && !this.rootMenu.backgroundColor) return; if (this.mode === 'horizontal' && !this.rootMenu.backgroundColor) return;
this.$refs['submenu-title'].style.backgroundColor = this.rootMenu.backgroundColor || ''; const title = this.$refs['submenu-title'];
title && (title.style.backgroundColor = this.rootMenu.backgroundColor || '');
} }
}, },
created() { created() {