UNPKG

vue-ant-patterns

Version:

vue-ant-patterns

104 lines (89 loc) 2.51 kB
import _extends from 'babel-runtime/helpers/extends'; import _defineProperty from 'babel-runtime/helpers/defineProperty'; import PropTypes from 'ant-design-vue/es/_util/vue-types'; import { hasProp } from 'ant-design-vue/es/_util/props-util'; import cx from 'classnames'; import Container from '../d-container'; var Horizontal = Container.Horizontal, Vertical = Container.Vertical; var depotProps = { flex: true, justify: 'start', align: 'center', grow: true }; var PaginationBox = { name: 'DPaginationBox', props: { prefixCls: PropTypes.string.def('depot-pagination-box'), // 子组件是否自带滚动 subScroll: PropTypes.bool, // 自身滚动 scroll: PropTypes.bool.def(true) }, data: function data() { var _$props = this.$props, subScroll = _$props.subScroll, scroll = _$props.scroll; var vSubScroll = false; var vScroll = scroll; // 子组件自身支持滚动 if (hasProp(this, 'subScroll')) { vSubScroll = subScroll; // 如果子组件支持滚动的话, 当前组件不在提供滚动 vScroll = !subScroll; } if (!scroll && !subScroll) { vScroll = false; } return { vSubScroll: vSubScroll, vScroll: vScroll }; }, render: function render() { var _cx; var h = arguments[0]; // adsad var prefixCls = this.prefixCls, $slots = this.$slots, vSubScroll = this.vSubScroll, vScroll = this.vScroll; var wrapProps = { 'class': cx((_cx = {}, _defineProperty(_cx, prefixCls, 1), _defineProperty(_cx, prefixCls + '-scroll', vScroll), _defineProperty(_cx, prefixCls + '-scroll-sub', vSubScroll), _cx)), props: _extends({}, depotProps, { align: 'start' }) }; var contentProps = { props: { grow: true, flex: vSubScroll }, 'class': _defineProperty({}, prefixCls + '-content', 1) }; var headerCls = prefixCls + '-headr'; var footerCls = prefixCls + '-footer'; return h( Vertical, wrapProps, [$slots.header ? h( 'div', { 'class': headerCls }, [$slots.header] ) : null, h( Container, contentProps, [$slots['default']] ), $slots.footer ? h( 'div', { 'class': footerCls }, [$slots.footer] ) : null] ); } }; PaginationBox.install = function (Vue) { Vue.component(PaginationBox.name, PaginationBox); }; export default PaginationBox;