Skip to content

Commit

Permalink
perf(tooltip): convert template to render function (#1310)
Browse files Browse the repository at this point in the history
* [tooltip] convert to render function

* Delete tooltip.vue
  • Loading branch information
tmorehouse committed Nov 10, 2017
1 parent 1736eb9 commit c812cb0
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 48 deletions.
45 changes: 43 additions & 2 deletions src/components/tooltip/tooltip.js
@@ -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;
}
}
};
46 changes: 0 additions & 46 deletions src/components/tooltip/tooltip.vue

This file was deleted.

0 comments on commit c812cb0

Please sign in to comment.