UNPKG

vue-ant-patterns

Version:

vue-ant-patterns

115 lines (104 loc) 2.86 kB
import _defineProperty from 'babel-runtime/helpers/defineProperty'; import _extends from 'babel-runtime/helpers/extends'; import PropTypes from 'ant-design-vue/es/_util/vue-types'; import cx from 'classnames'; import { Drawer } from 'ant-design-vue'; import drawerProps from './drawerProps'; var DDrawer = { name: 'DDrawer', props: _extends({}, drawerProps()), data: function data() { var visible = this.visible; return { sVisible: visible || false }; }, model: { prop: 'visible', event: 'close' }, watch: { visible: function visible(v) { this.sVisible = v; } }, mounted: function mounted() { // setTimeout(() => { // this.$refs.cnft.style = "100%"; // }, 0); }, methods: { submitBarNode: function submitBarNode() { var h = this.$createElement; var $slots = this.$slots; var submitBar = $slots.submitBar; return submitBar ? h( 'div', { 'class': 'drawer-submit-bar' }, [submitBar] ) : null; }, close: function close() { this.sVisible = false; this.$emit('close', false); }, renderContainer: function renderContainer() { var h = this.$createElement; return h( 'div', { 'class': 'drawer-scroll-container', ref: 'cnft' }, [this.$slots['default']] ); } }, render: function render() { var _cx; var h = arguments[0]; var prefixCls = this.prefixCls, $slots = this.$slots, $listeners = this.$listeners, width = this.width, sVisible = this.sVisible, title = this.title, closable = this.closable, wrapStyle = this.wrapStyle, maskClosable = this.maskClosable, wrapClassName = this.wrapClassName; var wpCls = cx((_cx = {}, _defineProperty(_cx, prefixCls, 1), _defineProperty(_cx, wrapClassName, 1), _defineProperty(_cx, 'drawer-submit-bar', $slots.submitBar), _defineProperty(_cx, prefixCls + '-no-title', !title && !$slots.title), _cx)); var drawerProps = { 'class': prefixCls, props: { visible: sVisible, width: width, maskClosable: maskClosable, closable: closable, wrapStyle: wrapStyle, wrapClassName: wpCls, destroyOnClose: true }, on: _extends({}, $listeners, { close: this.close }) }; return h( Drawer, drawerProps, [h( 'template', { slot: 'title' }, [title || $slots.title] ), h( 'transition', { attrs: { name: 'fade', mode: 'out-in', appear: true } }, [this.renderContainer()] ), this.submitBarNode()] ); } }; DDrawer.drawerProps = drawerProps; DDrawer.install = function (Vue) { Vue.component(DDrawer.name, DDrawer); }; export default DDrawer;