🌐 AI搜索 & 代理 主页
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/components/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,13 +588,12 @@ export const BModal = /*#__PURE__*/ Vue.extend({
this.emitEvent(this.buildEvent(EVENT_NAME_HIDDEN))
})
},
// Event emitter
emitEvent(bvModalEvt) {
const type = bvModalEvt.type
// We emit on root first incase a global listener wants to cancel
emitEvent(bvEvent) {
const { type } = bvEvent
// We emit on `$root` first in case a global listener wants to cancel
// the event first before the instance emits its event
this.emitOnRoot(getRootEventName(NAME_MODAL, type), bvModalEvt, bvModalEvt.componentId)
this.$emit(type, bvModalEvt)
this.emitOnRoot(getRootEventName(NAME_MODAL, type), bvEvent, bvEvent.componentId)
this.$emit(type, bvEvent)
},
// UI event handlers
onDialogMousedown() {
Expand Down
13 changes: 5 additions & 8 deletions src/components/tooltip/helpers/bv-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import { toInteger } from '../../../utils/number'
import { keys } from '../../../utils/object'
import { warn } from '../../../utils/warn'
import { BvEvent } from '../../../utils/bv-event.class'
import { listenOnRootMixin } from '../../../mixins/listen-on-root'
import { BVTooltipTemplate } from './bv-tooltip-template'

// --- Constants ---
Expand Down Expand Up @@ -138,6 +139,7 @@ const templateData = {
// @vue/component
export const BVTooltip = /*#__PURE__*/ Vue.extend({
name: NAME_TOOLTIP_HELPER,
mixins: [listenOnRootMixin],
data() {
return {
// BTooltip/BPopover/VBTooltip/VBPopover will update this data
Expand Down Expand Up @@ -681,14 +683,9 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({
})
},
emitEvent(bvEvent) {
// Emits a BvEvent on $root and this instance
const eventName = bvEvent.type
const $root = this.$root
if ($root && $root.$emit) {
// Emit an event on $root
$root.$emit(getRootEventName(this.templateType, eventName), bvEvent)
}
this.$emit(eventName, bvEvent)
const { type } = bvEvent
this.emitOnRoot(getRootEventName(this.templateType, type), bvEvent)
this.$emit(type, bvEvent)
},
// --- Event handler setup methods ---
listen() {
Expand Down
2 changes: 1 addition & 1 deletion src/mixins/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ export const dropdownMixin = Vue.extend({
// Event emitter
emitEvent(bvEvent) {
const { type } = bvEvent
this.emitOnRoot(getRootEventName(NAME_DROPDOWN, type), bvEvent)
this.$emit(type, bvEvent)
this.emitOnRoot(getRootEventName(NAME_DROPDOWN, type))
},
showMenu() {
if (this.disabled) {
Expand Down