/**version-1.0*/
let modules = {};

modules = {
	install: function(Vue) {
		Vue.directive('el-dialog-center', {
			bind(el, binding, vnode) {
				if (el.children[0].querySelector(
						".el-dialog__body")) {
					let autoTop = (document.body.offsetHeight - el.children[0]
						.offsetHeight) / 2;
					if (autoTop < 0) {
						autoTop = 0;
					}
					el.children[0].style["margin-top"] = autoTop + 'px';
				} else {
					vnode.child.$nextTick(() => {
						if (el.children[0].querySelector(
								".el-dialog__body")) {
							let autoTop = (document.body.offsetHeight - el.children[0]
								.offsetHeight) / 2;
							if (autoTop < 0) {
								autoTop = 0;
							}
							el.children[0].style["margin-top"] = autoTop + 'px';
						}
					});
				}
			}
		})
	}
};

export default modules
