From f5e76f7baef94c0ef9e74f61d56a010827c464b9 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 5 Sep 2019 01:46:28 -0300 Subject: [PATCH 1/3] chore: tooltip/popover directives execute title/content if function before each show --- src/directives/popover/popover.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/directives/popover/popover.js b/src/directives/popover/popover.js index c42a7896159..db6da9a1b48 100644 --- a/src/directives/popover/popover.js +++ b/src/directives/popover/popover.js @@ -180,6 +180,20 @@ const applyPopover = (el, bindings, vnode) => { _scopeId: getScopId($parent, undefined) }) el[BV_POPOVER].__bv_prev_data__ = {} + el[BV_POPOVER].$on('show', () => { + // Before showing the popover, we update the title + // and content if they are functions + const data = {} + if (isFunction(config.title)) { + data.title = config.title() + } + if (isFunction(config.content)) { + data.content = config.content() + } + if (keys(data).length > 0) { + el[BV_POPOVER].updateData(data) + } + }) } const data = { title: config.title, From f033927c543cc58d45cde815dbd53a04a65af174 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 5 Sep 2019 01:52:00 -0300 Subject: [PATCH 2/3] Update popover.js --- src/directives/popover/popover.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/directives/popover/popover.js b/src/directives/popover/popover.js index db6da9a1b48..27350b84b58 100644 --- a/src/directives/popover/popover.js +++ b/src/directives/popover/popover.js @@ -180,7 +180,7 @@ const applyPopover = (el, bindings, vnode) => { _scopeId: getScopId($parent, undefined) }) el[BV_POPOVER].__bv_prev_data__ = {} - el[BV_POPOVER].$on('show', () => { + el[BV_POPOVER].$on('show', () => /* istanbul ignore next: for now */ { // Before showing the popover, we update the title // and content if they are functions const data = {} From 1c18ae91c727c522fba48b91f6d553b59b7a6c6e Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 5 Sep 2019 02:03:34 -0300 Subject: [PATCH 3/3] Update tooltip.js --- src/directives/tooltip/tooltip.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/directives/tooltip/tooltip.js b/src/directives/tooltip/tooltip.js index a6b395d07c6..8f6f2f2c36f 100644 --- a/src/directives/tooltip/tooltip.js +++ b/src/directives/tooltip/tooltip.js @@ -181,6 +181,14 @@ const applyTooltip = (el, bindings, vnode) => { _scopeId: getScopId($parent, undefined) }) el[BV_TOOLTIP].__bv_prev_data__ = {} + el[BV_TOOLTIP].$on('show', () => /* istanbul ignore next: for now */ { + // Before showing the tooltip, we update the title if it is a function + if (isFunction(config.title)) { + el[BV_TOOLTIP].updateData({ + title: config.title() + }) + } + }) } const data = { title: config.title,