lg_frontend/plugins/dialog/dialog.js

78 lines
2.6 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import _defineProperty from 'babel-runtime/helpers/defineProperty'
import classNames from "classnames";
import Dialog from "ant-design-vue/es/modal/Modal";
import warning from 'ant-design-vue/es/_util/warning';
export default {
functional: true,
render: function render(h, context) {
var props = context.props;
var close = props.close,
zIndex = props.zIndex,
afterClose = props.afterClose,
visible = props.visible,
keyboard = props.keyboard,
centered = props.centered,
getContainer = props.getContainer,
maskStyle = props.maskStyle,
_props$closable = props.closable,
closable = _props$closable === undefined ? true : _props$closable;
warning(!('iconType' in props), 'Modal', 'The property \'iconType\' is deprecated. Use the property \'icon\' instead.');
var prefixCls = props.prefixCls || 'ant-modal';
var contentPrefixCls = prefixCls + '-confirm2';
// 默认为 true保持向下兼容
var width = props.width || 416;
var title = props.title || '';
var style = props.style || {};
var onClose = props.onClose || null;
var mask = props.mask === undefined ? true : props.mask;
// 默认为 false保持旧版默认行为
var maskClosable = props.maskClosable === undefined ? false : props.maskClosable;
var transitionName = props.transitionName || 'zoom';
var maskTransitionName = props.maskTransitionName || 'fade';
var classString = classNames(contentPrefixCls, contentPrefixCls + '-' + props.type, prefixCls + '-' + props.type, props['class']);
return h(
Dialog,
{
attrs: {
prefixCls: prefixCls,
wrapClassName: classNames(_defineProperty({}, contentPrefixCls + '-centered', !!centered)),
visible: visible,
closable: closable,
title: title,
transitionName: transitionName,
footer: null,
maskTransitionName: maskTransitionName,
mask: mask,
maskClosable: maskClosable,
maskStyle: maskStyle,
width: width,
zIndex: zIndex,
afterClose: afterClose,
keyboard: keyboard,
centered: centered,
getContainer: getContainer
},
'class': classString,
on: {
'cancel': function cancel(e) {
onClose && onClose()
return close({ triggerCancel: true }, e);
}
},
style: style,
},
[h(
'div',
{ 'class': contentPrefixCls + '-content' },
[typeof props.content === 'function' ? props.content(h) : props.content]
)]
);
}
};