From a87da6896f12c262748e97f4b179c4996a6f8845 Mon Sep 17 00:00:00 2001 From: Rijn <bxbian951122@gmail.com> Date: Tue, 21 Feb 2017 11:55:05 -0600 Subject: [PATCH] added scrollable property to modal instance --- src/components/modal/confirm.js | 9 +++++++-- test/routers/more.vue | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/components/modal/confirm.js b/src/components/modal/confirm.js index 3a84834..46b1b42 100644 --- a/src/components/modal/confirm.js +++ b/src/components/modal/confirm.js @@ -17,7 +17,7 @@ Modal.newInstance = properties => { const div = document.createElement('div'); div.innerHTML = ` - <Modal${props} :visible.sync="visible" :width="width"> + <Modal${props} :visible.sync="visible" :width="width" :scrollable.sync="scrollable"> <div class="${prefixCls}"> <div class="${prefixCls}-head"> <div class="${prefixCls}-head-title">{{{ title }}}</div> @@ -49,7 +49,8 @@ Modal.newInstance = properties => { cancelText: t('i.modal.cancelText'), showCancel: false, loading: false, - buttonLoading: false + buttonLoading: false, + scrollable: false }), computed: { iconTypeCls () { @@ -153,6 +154,10 @@ Modal.newInstance = properties => { modal.$parent.loading = props.loading; } + if ('scrollable' in props) { + modal.$parent.scrollable = props.scrollable; + } + // notice when component destroy modal.$parent.onRemove = props.onRemove; diff --git a/test/routers/more.vue b/test/routers/more.vue index 9a702f2..a820145 100644 --- a/test/routers/more.vue +++ b/test/routers/more.vue @@ -18,6 +18,8 @@ <p>对话框内容</p> <i-button @click="scrollable = !scrollable">Toggle scrollable</i-button> </Modal> + <i-button @click="instance(true)">Create Instance Scrollable</i-button> + <i-button @click="instance(false)">Create Instance Non-scrollable</i-button> </template> <script> export default { @@ -34,6 +36,13 @@ }, cancel () { this.$Message.info('点击了取消'); + }, + instance (scrollable) { + this.$Modal.info({ + title: 'test', + content: 'test', + scrollable: scrollable + }); } } } -- libgit2 0.21.4