ant-design-vue
Version:
An enterprise-class UI design language and Vue-based implementation
43 lines (41 loc) • 1.47 kB
JavaScript
import _defineProperty from 'babel-runtime/helpers/defineProperty';
import PropTypes from '../../_util/vue-types';
import { getComponentFromProp } from '../../_util/props-util';
export default {
name: 'TabPane',
props: {
active: PropTypes.bool,
destroyInactiveTabPane: PropTypes.bool,
forceRender: PropTypes.bool,
placeholder: PropTypes.any,
rootPrefixCls: PropTypes.string,
tab: PropTypes.any,
closable: PropTypes.bool,
disabled: PropTypes.bool
},
render: function render() {
var _cls;
var h = arguments[0];
var _$props = this.$props,
destroyInactiveTabPane = _$props.destroyInactiveTabPane,
active = _$props.active,
forceRender = _$props.forceRender,
rootPrefixCls = _$props.rootPrefixCls;
var children = this.$slots['default'];
var placeholder = getComponentFromProp(this, 'placeholder');
this._isActived = this._isActived || active;
var prefixCls = rootPrefixCls + '-tabpane';
var cls = (_cls = {}, _defineProperty(_cls, prefixCls, 1), _defineProperty(_cls, prefixCls + '-inactive', !active), _defineProperty(_cls, prefixCls + '-active', active), _cls);
var isRender = destroyInactiveTabPane ? active : this._isActived;
return h(
'div',
{
'class': cls,
attrs: { role: 'tabpanel',
'aria-hidden': active ? 'false' : 'true'
}
},
[isRender || forceRender ? children : placeholder]
);
}
};