Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(tooltip): convert template to render function (#1310)
* [tooltip] convert to render function * Delete tooltip.vue
- Loading branch information
1 parent
1736eb9
commit c812cb0
Showing
2 changed files
with
43 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,44 @@ | ||
import bTooltip from './tooltip.vue'; | ||
import ToolTip from '../../utils/tooltip.class'; | ||
import { warn } from '../../utils'; | ||
import { toolpopMixin } from '../../mixins'; | ||
|
||
export default bTooltip; | ||
export default { | ||
mixins: [ toolpopMixin ], | ||
render(h) { | ||
return h( | ||
'div', | ||
{ class: [ 'd-none' ], style: { display: 'none' }, attrs: { 'aria-hidden': true } }, | ||
[ h('div', { ref: 'title' }, this.$slots.default) ] | ||
); | ||
}, | ||
data() { | ||
return {}; | ||
}, | ||
props: { | ||
title: { | ||
type: String, | ||
default: '' | ||
}, | ||
triggers: { | ||
type: [String, Array], | ||
default: 'hover focus' | ||
}, | ||
placement: { | ||
type: String, | ||
default: 'top' | ||
} | ||
}, | ||
methods: { | ||
createToolpop() { | ||
// getTarget is in toolpop mixin | ||
const target = this.getTarget(); | ||
if (target) { | ||
this._toolpop = new ToolTip(target, this.getConfig(), this.$root); | ||
} else { | ||
this._toolpop = null; | ||
warn("b-tooltip: 'target' element not found!"); | ||
} | ||
return this._toolpop; | ||
} | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.