Commit e011898cc72ab1fb3eed5c2f40690449d055a8ca
1 parent
51f9f894
fixed #197
fixed #197
Showing
2 changed files
with
26 additions
and
9 deletions
Show diff stats
src/components/modal/modal.vue
@@ -197,11 +197,12 @@ | @@ -197,11 +197,12 @@ | ||
197 | visible (val) { | 197 | visible (val) { |
198 | if (val === false) { | 198 | if (val === false) { |
199 | this.buttonLoading = false; | 199 | this.buttonLoading = false; |
200 | - setTimeout(() => { | 200 | + this.timer = setTimeout(() => { |
201 | this.wrapShow = false; | 201 | this.wrapShow = false; |
202 | this.removeScrollEffect(); | 202 | this.removeScrollEffect(); |
203 | }, 300); | 203 | }, 300); |
204 | } else { | 204 | } else { |
205 | + if (this.timer) clearTimeout(this.timer); | ||
205 | this.wrapShow = true; | 206 | this.wrapShow = true; |
206 | this.addScrollEffect(); | 207 | this.addScrollEffect(); |
207 | } | 208 | } |
test/routers/more.vue
@@ -4,16 +4,32 @@ | @@ -4,16 +4,32 @@ | ||
4 | } | 4 | } |
5 | </style> | 5 | </style> |
6 | <template> | 6 | <template> |
7 | - <Tabs active-key="key1"> | ||
8 | - <Tab-pane label="标签一" key="key1"> | ||
9 | - <Date-picker type="date" placeholder="选择日期" style="width: 200px"></Date-picker> | ||
10 | - </Tab-pane> | ||
11 | - <Tab-pane label="标签二" key="key2">标签二的内容</Tab-pane> | ||
12 | - <Tab-pane label="标签三" key="key3">标签三的内容</Tab-pane> | ||
13 | - </Tabs> | 7 | + <i-button type="primary" @click="modal1 = true">显示对话框</i-button> |
8 | + <Modal | ||
9 | + :visible.sync="modal1" | ||
10 | + title="普通的Modal对话框标题" | ||
11 | + @on-ok="ok" | ||
12 | + @on-cancel="cancel"> | ||
13 | + <p>对话框内容</p> | ||
14 | + <p>对话框内容</p> | ||
15 | + <p>对话框内容</p> | ||
16 | + </Modal> | ||
14 | </template> | 17 | </template> |
15 | <script> | 18 | <script> |
16 | export default { | 19 | export default { |
17 | - | 20 | + data () { |
21 | + return { | ||
22 | + modal1: false | ||
23 | + } | ||
24 | + }, | ||
25 | + methods: { | ||
26 | + ok () { | ||
27 | + this.$nextTick(() => this.modal1 = true); | ||
28 | + this.$Message.info('点击了确定'); | ||
29 | + }, | ||
30 | + cancel () { | ||
31 | + this.$Message.info('点击了取消'); | ||
32 | + } | ||
33 | + } | ||
18 | } | 34 | } |
19 | </script> | 35 | </script> |