Commit a87da6896f12c262748e97f4b179c4996a6f8845
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 | 17 | |
18 | 18 | const div = document.createElement('div'); |
19 | 19 | div.innerHTML = ` |
20 | - <Modal${props} :visible.sync="visible" :width="width"> | |
20 | + <Modal${props} :visible.sync="visible" :width="width" :scrollable.sync="scrollable"> | |
21 | 21 | <div class="${prefixCls}"> |
22 | 22 | <div class="${prefixCls}-head"> |
23 | 23 | <div class="${prefixCls}-head-title">{{{ title }}}</div> |
... | ... | @@ -49,7 +49,8 @@ Modal.newInstance = properties => { |
49 | 49 | cancelText: t('i.modal.cancelText'), |
50 | 50 | showCancel: false, |
51 | 51 | loading: false, |
52 | - buttonLoading: false | |
52 | + buttonLoading: false, | |
53 | + scrollable: false | |
53 | 54 | }), |
54 | 55 | computed: { |
55 | 56 | iconTypeCls () { |
... | ... | @@ -153,6 +154,10 @@ Modal.newInstance = properties => { |
153 | 154 | modal.$parent.loading = props.loading; |
154 | 155 | } |
155 | 156 | |
157 | + if ('scrollable' in props) { | |
158 | + modal.$parent.scrollable = props.scrollable; | |
159 | + } | |
160 | + | |
156 | 161 | // notice when component destroy |
157 | 162 | modal.$parent.onRemove = props.onRemove; |
158 | 163 | ... | ... |
test/routers/more.vue
... | ... | @@ -18,6 +18,8 @@ |
18 | 18 | <p>对话框内容</p> |
19 | 19 | <i-button @click="scrollable = !scrollable">Toggle scrollable</i-button> |
20 | 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 | 23 | </template> |
22 | 24 | <script> |
23 | 25 | export default { |
... | ... | @@ -34,6 +36,13 @@ |
34 | 36 | }, |
35 | 37 | cancel () { |
36 | 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 | } | ... | ... |