ant-design-vue
Version:
An enterprise-class UI design language and Vue-based implementation
55 lines (48 loc) • 1.91 kB
JavaScript
import { isVNode as _isVNode, createVNode as _createVNode } from "vue";
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import PropTypes from '../../_util/vue-types';
import { getSlot } from '../../_util/props-util';
import { defineComponent } from 'vue';
function _isSlot(s) {
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);
}
export default defineComponent({
name: 'PanelContent',
props: {
prefixCls: PropTypes.string,
isActive: PropTypes.looseBool,
destroyInactivePanel: PropTypes.looseBool,
forceRender: PropTypes.looseBool,
role: PropTypes.any
},
data: function data() {
return {
_isActive: undefined
};
},
render: function render() {
var _contentCls;
this._isActive = this.forceRender || this._isActive || this.isActive;
if (!this._isActive) {
return null;
}
var _this$$props = this.$props,
prefixCls = _this$$props.prefixCls,
isActive = _this$$props.isActive,
destroyInactivePanel = _this$$props.destroyInactivePanel,
forceRender = _this$$props.forceRender,
role = _this$$props.role;
var contentCls = (_contentCls = {}, _defineProperty(_contentCls, "".concat(prefixCls, "-content"), true), _defineProperty(_contentCls, "".concat(prefixCls, "-content-active"), isActive), _contentCls);
var child = !forceRender && !isActive && destroyInactivePanel ? null : _createVNode("div", {
"class": "".concat(prefixCls, "-content-box")
}, [getSlot(this)]);
return _createVNode("div", {
"class": contentCls,
"role": role
}, _isSlot(child) ? child : {
default: function _default() {
return [child];
}
});
}
});