8000 feat(popover/tooltip): use `normalizeSlotMixin` · bootstrap-vue/bootstrap-vue@ca454ce · GitHub
[go: up one dir, main page]

Skip to content

Commit ca454ce

Browse files
committed
feat(popover/tooltip): use normalizeSlotMixin
1 parent 58c8310 commit ca454ce

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/components/popover/popover.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Vue } from '../../vue'
22
import { NAME_POPOVER } from '../../constants/components'
33
import { EVENT_NAME_CLICK } from '../../constants/events'
44
import { PROP_TYPE_ARRAY_STRING, PROP_TYPE_STRING } from '../../constants/props'
5+
import { SLOT_NAME_TITLE } from '../../constants/slots'
56
import { makeProp, makePropsConfigurable } from '../../utils/props'
67
import { BTooltip, props as BTooltipProps } from '../tooltip/tooltip'
78
import { BVPopover } from './helpers/bv-popover'
@@ -37,8 +38,8 @@ export const BPopover = /*#__PURE__*/ Vue.extend({
3738
// Popover: Default slot is `content`, `title` slot is title
3839
// We pass a scoped slot function references by default (Vue v2.6x)
3940
// And pass the title prop as a fallback
40-
this.setContent(this.$scopedSlots.default || this.content)
41-
this.setTitle(this.$scopedSlots.title || this.title)
41+
this.setContent(this.normalizeSlot() || this.content)
42+
this.setTitle(this.normalizeSlot(SLOT_NAME_TITLE) || this.title)
4243
}
4344
}
4445
// Render function provided by BTooltip

src/components/tooltip/tooltip.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { getScopeId } from '../../utils/get-scope-id'
2727
import { isUndefinedOrNull } from '../../utils/inspect'
2828
import { pick } from '../../utils/object'
2929
import { makeProp, makePropsConfigurable } from '../../utils/props'
30+
import { normalizeSlotMixin } from '../../mixins/normalize-slot'
3031
import { BVTooltip } from './helpers/bv-tooltip'
3132

3233
// --- Constants ---
@@ -81,6 +82,7 @@ export const props = makePropsConfigurable(
8182
// @vue/component
8283
export const BTooltip = /*#__PURE__*/ Vue.extend({
8384
name: NAME_TOOLTIP,
85+
mixins: [normalizeSlotMixin],
8486
inheritAttrs: false,
8587
props,
8688
data() {
@@ -234,7 +236,7 @@ export const BTooltip = /*#__PURE__*/ Vue.extend({
234236
// Popover: Default slot is `content`, `title` slot is title
235237
// We pass a scoped slot function reference by default (Vue v2.6x)
236238
// And pass the title prop as a fallback
237-
this.setTitle(this.$scopedSlots.default || this.title)
239+
this.setTitle(this.normalizeSlot() || this.title)
238240
},
239241
// Helper methods for `updateContent()`
240242
setTitle(value) {

0 commit comments

Comments
 (0)
0