From 5b376a49684a7ffb01eb58e7225fff36f02300d7 Mon Sep 17 00:00:00 2001 From: loganhz Date: Mon, 30 Jul 2018 12:02:57 +0800 Subject: [PATCH] Fix the issue that tooltip always shows --- .../addon/components/action-menu/component.js | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/shared/addon/components/action-menu/component.js b/lib/shared/addon/components/action-menu/component.js index 47cd983f1..df30fb564 100644 --- a/lib/shared/addon/components/action-menu/component.js +++ b/lib/shared/addon/components/action-menu/component.js @@ -1,7 +1,7 @@ import Component from '@ember/component'; import layout from './template'; import { inject as service } from '@ember/service' -import { computed, get } from '@ember/object'; +import { computed, get, set } from '@ember/object'; import calculatePosition from 'shared/utils/calculate-position'; @@ -19,19 +19,20 @@ export default Component.extend({ actions: { clickedAction(actionName) { - this.get('resourceActions').triggerAction(actionName); + get(this, 'resourceActions').triggerAction(actionName); + set(get(this, 'tooltipService'), 'childOpened', false); }, preload() { - this.get('resourceActions').setActionItems(this.get('model'), this.get('context')); + get(this, 'resourceActions').setActionItems(get(this, 'model'), get(this, 'context')); }, actionsOpen() { - get(this, 'tooltipService').set('childOpened', true); + set(get(this, 'tooltipService'), 'childOpened', true); }, actionsClosed() { - get(this, 'tooltipService').set('childOpened', false); + set(get(this, 'tooltipService'), 'childOpened', false); get(this, 'tooltipService').hide(); }, @@ -39,7 +40,7 @@ export default Component.extend({ }, sizeClass: computed('size', function() { - let size = this.get('size'); + let size = get(this, 'size'); if ( size && size !== 'md' ) { return `btn-${ size }`; @@ -56,13 +57,13 @@ export default Component.extend({ e.preventDefault(); e.stopPropagation(); - if (this.get('inTooltip')) { - this.get('resourceActions').set('tooltipActions', true); + if (get(this, 'inTooltip')) { + set(get(this, 'resourceActions'), 'tooltipActions', true); } else { - this.get('resourceActions').set('tooltipActions', false); + set(get(this, 'resourceActions'), 'tooltipActions', false); } - this.get('resourceActions').setActionItems(this.get('model'), this.get('context')); + get(this, 'resourceActions').setActionItems(get(this, 'model'), get(this, 'context')); } }, });