Commit a87da6896f12c262748e97f4b179c4996a6f8845

Authored by Rijn
1 parent 59872199

added scrollable property to modal instance

Showing 2 changed files with 16 additions and 2 deletions   Show diff stats
src/components/modal/confirm.js
@@ -17,7 +17,7 @@ Modal.newInstance = properties => { @@ -17,7 +17,7 @@ Modal.newInstance = properties => {
17 17
18 const div = document.createElement('div'); 18 const div = document.createElement('div');
19 div.innerHTML = ` 19 div.innerHTML = `
20 - <Modal${props} :visible.sync="visible" :width="width"> 20 + <Modal${props} :visible.sync="visible" :width="width" :scrollable.sync="scrollable">
21 <div class="${prefixCls}"> 21 <div class="${prefixCls}">
22 <div class="${prefixCls}-head"> 22 <div class="${prefixCls}-head">
23 <div class="${prefixCls}-head-title">{{{ title }}}</div> 23 <div class="${prefixCls}-head-title">{{{ title }}}</div>
@@ -49,7 +49,8 @@ Modal.newInstance = properties =&gt; { @@ -49,7 +49,8 @@ Modal.newInstance = properties =&gt; {
49 cancelText: t('i.modal.cancelText'), 49 cancelText: t('i.modal.cancelText'),
50 showCancel: false, 50 showCancel: false,
51 loading: false, 51 loading: false,
52 - buttonLoading: false 52 + buttonLoading: false,
  53 + scrollable: false
53 }), 54 }),
54 computed: { 55 computed: {
55 iconTypeCls () { 56 iconTypeCls () {
@@ -153,6 +154,10 @@ Modal.newInstance = properties =&gt; { @@ -153,6 +154,10 @@ Modal.newInstance = properties =&gt; {
153 modal.$parent.loading = props.loading; 154 modal.$parent.loading = props.loading;
154 } 155 }
155 156
  157 + if ('scrollable' in props) {
  158 + modal.$parent.scrollable = props.scrollable;
  159 + }
  160 +
156 // notice when component destroy 161 // notice when component destroy
157 modal.$parent.onRemove = props.onRemove; 162 modal.$parent.onRemove = props.onRemove;
158 163
test/routers/more.vue
@@ -18,6 +18,8 @@ @@ -18,6 +18,8 @@
18 <p>对话框内容</p> 18 <p>对话框内容</p>
19 <i-button @click="scrollable = !scrollable">Toggle scrollable</i-button> 19 <i-button @click="scrollable = !scrollable">Toggle scrollable</i-button>
20 </Modal> 20 </Modal>
  21 + <i-button @click="instance(true)">Create Instance Scrollable</i-button>
  22 + <i-button @click="instance(false)">Create Instance Non-scrollable</i-button>
21 </template> 23 </template>
22 <script> 24 <script>
23 export default { 25 export default {
@@ -34,6 +36,13 @@ @@ -34,6 +36,13 @@
34 }, 36 },
35 cancel () { 37 cancel () {
36 this.$Message.info('点击了取消'); 38 this.$Message.info('点击了取消');
  39 + },
  40 + instance (scrollable) {
  41 + this.$Modal.info({
  42 + title: 'test',
  43 + content: 'test',
  44 + scrollable: scrollable
  45 + });
37 } 46 }
38 } 47 }
39 } 48 }