From cbfd9cfab358cbd10146ec8238da4b11aabfe594 Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Thu, 9 Nov 2017 15:12:16 +0800 Subject: [PATCH] Menu: fix console error --- packages/menu/src/submenu.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/menu/src/submenu.vue b/packages/menu/src/submenu.vue index b4adc7fcc..8cf59b572 100644 --- a/packages/menu/src/submenu.vue +++ b/packages/menu/src/submenu.vue @@ -173,11 +173,13 @@ }, handleTitleMouseenter() { 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() { 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() {