Commit 1b785ff08bbf00c96f4b1cdca4d83aef72dd30ef
Committed by
GitHub
Merge pull request #1054 from lcx960324/2.0
Bugfix: Notice & Message's destroy method.
Showing
4 changed files
with
8 additions
and
4 deletions
Show diff stats
examples/routers/notice.vue
... | ... | @@ -10,6 +10,7 @@ |
10 | 10 | <Button @click="success(true)">成功</Button> |
11 | 11 | <Button @click="warning(true)">警告</Button> |
12 | 12 | <Button @click="error(true)">错误</Button> |
13 | + <Button @click="destroy()">销毁</Button> | |
13 | 14 | </div> |
14 | 15 | </template> |
15 | 16 | <script> |
... | ... | @@ -38,6 +39,9 @@ |
38 | 39 | title: '这是通知标题', |
39 | 40 | desc: nodesc ? '' : '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述' |
40 | 41 | }); |
42 | + }, | |
43 | + destroy () { | |
44 | + this.$Notice.destroy(); | |
41 | 45 | } |
42 | 46 | } |
43 | 47 | } | ... | ... |
src/components/base/notification/index.js
... | ... | @@ -25,10 +25,10 @@ Notification.newInstance = properties => { |
25 | 25 | notification.close(name); |
26 | 26 | }, |
27 | 27 | component: notification, |
28 | - destroy () { | |
28 | + destroy (element) { | |
29 | 29 | notification.closeAll(); |
30 | 30 | setTimeout(function() { |
31 | - document.body.removeChild(document.getElementsByClassName('ivu-message')[0].parentElement); | |
31 | + document.body.removeChild(document.getElementsByClassName(element)[0]); | |
32 | 32 | }, 500); |
33 | 33 | } |
34 | 34 | }; | ... | ... |
src/components/message/index.js
src/components/notice/index.js