Commit abb2cae6dae0b31b2dee64f6d36aa58facd5d81b

Authored by Aresn
Committed by GitHub
2 parents 6af235b1 34324f28

Merge pull request #2568 from lison16/modal

add closable props for $Modal https://github.com/iview/iview/issues/2362
examples/routers/modal.vue
... ... @@ -18,6 +18,7 @@
18 18 <i-option v-for="item in options" :value="item.value" :key="item.value">{{ item.label }}</i-option>
19 19 </i-select>
20 20 </Modal>
  21 + <Button @click="showModelFunc">弹出</Button>
21 22 </div>
22 23 </template>
23 24 <script>
... ... @@ -123,6 +124,13 @@
123 124 item.loading = false;
124 125 callback();
125 126 }, 1000);
  127 + },
  128 + showModelFunc () {
  129 + this.$Modal.success({
  130 + title: 'haha',
  131 + content: 'lsisdfsdfsdfs',
  132 + closable: false
  133 + });
126 134 }
127 135 }
128 136 }
... ...
src/components/modal/confirm.js
... ... @@ -22,7 +22,8 @@ Modal.newInstance = properties =&gt; {
22 22 showCancel: false,
23 23 loading: false,
24 24 buttonLoading: false,
25   - scrollable: false
  25 + scrollable: false,
  26 + closable: true
26 27 }),
27 28 render (h) {
28 29 let footerVNodes = [];
... ... @@ -80,7 +81,8 @@ Modal.newInstance = properties =&gt; {
80 81 return h(Modal, {
81 82 props: Object.assign({}, _props, {
82 83 width: this.width,
83   - scrollable: this.scrollable
  84 + scrollable: this.scrollable,
  85 + closable: this.closable
84 86 }),
85 87 domProps: {
86 88 value: this.visible
... ... @@ -210,6 +212,10 @@ Modal.newInstance = properties =&gt; {
210 212 modal.$parent.width = props.width;
211 213 }
212 214  
  215 + if ('closable' in props) {
  216 + modal.$parent.closable = props.closable;
  217 + }
  218 +
213 219 if ('title' in props) {
214 220 modal.$parent.title = props.title;
215 221 }
... ...