Permalink
Browse files

perf(tabs): convert templates to render functions (#1319)

* [tab] convert to render function

* Delete tab.vue

* [tabs] convert to reder function

* Delete tabs.vue
  • Loading branch information...
tmorehouse committed Nov 10, 2017
1 parent c3bff30 commit b45f550e9d5978402b1880b710c8687d75ac19fc
Showing with 453 additions and 368 deletions.
  1. +120 −2 src/components/tabs/tab.js
  2. +0 −113 src/components/tabs/tab.vue
  3. +333 −2 src/components/tabs/tabs.js
  4. +0 −251 src/components/tabs/tabs.vue
@@ -1,3 +1,121 @@
import bTab from './tab.vue';
import { idMixin } from '../../mixins';
export default bTab;
export default {
mixins: [idMixin],
render(h) {
const t = this;
const content = h(
t.tag,
{
ref: 'panel',
class: t.tabClasses,
directives: [ { name: 'show', value: t.localActive } ],
attrs: {
role: 'tabpanel',
id: t.safeId(),
'aria-hidden': t.localActive ? 'false' : 'true',
'aria-expanded': t.localActive ? 'true' : 'false',
'aria-lablelledby': t.controlledBy || null
},
},
[ t.$slots.default ]
);
return h(
'transition',
{
props: { mode: 'out-in' },
on: {
beforeEnter: t.beforeEnter,
afterEnter: t.afterEnter,
afterLeave: t.afterLeave
}
},
[ content ]
);
},
methods: {
beforeEnter() {
this.show = false;
},
afterEnter() {
this.show = true;
},
afterLeave() {
this.show = false;
}
},
data() {
return {
localActive: this.active && !this.disabled,
show: false
};
},
mounted() {
this.show = this.localActive;
},
computed: {
tabClasses() {
return [
'tab-pane',
this.show ? 'show' : '',
this.computedFade ? 'fade' : '',
this.disabled ? 'disabled' : '',
this.localActive ? 'active' : ''
];
},
controlledBy() {
return this.buttonId || this.safeId('__BV_tab_button__');
},
computedFade() {
return this.$parent.fade;
},
computedLazy() {
return this.$parent.lazy;
},
_isTab() {
// For parent sniffing of child
return true;
}
},
props: {
active: {
type: Boolean,
default: false
},
tag: {
type: String,
default: 'div'
},
buttonId: {
type: String,
default: ''
},
title: {
type: String,
default: ''
},
titleItemClass: {
// Sniffed by tabs.vue and added to nav 'li.nav-item'
type: [String, Array, Object],
default: null
},
titleLinkClass: {
// Sniffed by tabs.vue and added to nav 'a.nav-link'
type: [String, Array, Object],
default: null
},
headHtml: {
// Is this actually ever used?
type: String,
default: null
},
disabled: {
type: Boolean,
default: false
},
href: {
type: String,
default: '#'
}
}
};

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit b45f550

Please sign in to comment.