diff --git a/src/application/mk/components/dialog/dialog.vue b/src/application/mk/components/dialog/dialog.vue index ea5b282..9e8cdfe 100644 --- a/src/application/mk/components/dialog/dialog.vue +++ b/src/application/mk/components/dialog/dialog.vue @@ -44,8 +44,11 @@ export default { }, methods: { - + // 打开弹窗 open(options) { + // 解构赋值 page 页面组件 title 标题 callback 回调函数 pageMode 模式 add edit select dataId 数据id width 宽度 height 高度 pageOptions 页面参数 + // pageOptions 用于传递给页面的参数 例如:{id:1,name:'张三'} 页面通过 this.$options.pageOptions 获取 + // showFooter 是否显示底部按钮 const { page, title, callback, pageMode, dataId,width = 800,height = 600 , pageOptions = {} ,showFooter } = options || {}; this.width = width; @@ -57,21 +60,30 @@ export default { this.app = page; this.callback = callback; this.showFooter = showFooter; - + // 设置延迟显示,解决弹窗显示不全的问题 setTimeout(() => { this.visible = true; }, 10); }, + + // 处理回调 handleCallback(e) { const { callback } = this; + // 判断是否有回调函数 if (callback) { + // 执行回调 callback(e); + // 关闭弹窗 this.$destroy(); } }, + + // 关闭弹窗 modalClose() { this.$destroy(); }, + + // 确认事件 confirmEvent(){ const { callback } = this; let data = this.$refs.appPage.getConfirmData(); diff --git a/src/application/mk/components/dialog/index.js b/src/application/mk/components/dialog/index.js index 548fb12..33abda5 100644 --- a/src/application/mk/components/dialog/index.js +++ b/src/application/mk/components/dialog/index.js @@ -4,7 +4,7 @@ import promptComponent from './dialog.vue' // 加载dialog组件 export default { - + // 打开对话框 open: function (args) { // 打开对话框 const promptConstructor = Vue.extend(promptComponent); // 创建一个子类 let instance = new promptConstructor().$mount(''); // 创建一个实例 diff --git a/src/application/mk/components/editors/MkGridDataSelector.vue b/src/application/mk/components/editors/MkGridDataSelector.vue index 91d578e..4c5780c 100644 --- a/src/application/mk/components/editors/MkGridDataSelector.vue +++ b/src/application/mk/components/editors/MkGridDataSelector.vue @@ -31,7 +31,7 @@ diff --git a/src/application/mk/components/toolbar/toolbar.vue b/src/application/mk/components/toolbar/toolbar.vue index 2298fba..9940a58 100644 --- a/src/application/mk/components/toolbar/toolbar.vue +++ b/src/application/mk/components/toolbar/toolbar.vue @@ -1,5 +1,5 @@