diff --git a/src/directives/popover/popover.js b/src/directives/popover/popover.js index c42a7896159..27350b84b58 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', () => /* istanbul ignore next: for now */ { + // 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, 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,